File tree Expand file tree Collapse file tree 8 files changed +45
-14
lines changed Expand file tree Collapse file tree 8 files changed +45
-14
lines changed Original file line number Diff line number Diff line change 3838 matrix :
3939 stable : [true]
4040 crystal :
41- - 1.0.0
42- - 1.1.1
4341 - 1.2.2
42+ - 1.3.2
43+ - 1.4.0
4444 include :
4545 - crystal : nightly
4646 stable : false
Original file line number Diff line number Diff line change @@ -14,11 +14,11 @@ shards:
1414
1515 exception_page:
1616 git: https://github.com/crystal-loot/exception_page.git
17- version: 0.2.0
17+ version: 0.2.2
1818
1919 kemal:
2020 git: https://github.com/kemalcr/kemal.git
21- version: 1.1.0
21+ version: 1.1.2
2222
2323 kilt:
2424 git: https://github.com/jeromegn/kilt.git
Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ dependencies:
1818 version : ~> 0.18.0
1919 kemal :
2020 github : kemalcr/kemal
21- version : ~> 1.1.0
21+ version : ~> 1.1.2
22+ kilt :
23+ github : jeromegn/kilt
24+ version : ~> 0.6.1
2225 protodec :
2326 github : iv-org/protodec
2427 version : ~> 0.1.4
Original file line number Diff line number Diff line change 1+ # Overrides for Kemal's `content_for` macro in order to keep using
2+ # kilt as it was before Kemal v1.1.1 (Kemal PR #618).
3+
4+ require " kemal"
5+ require " kilt"
6+
7+ macro content_for (key , file = __FILE__ )
8+ % proc = - > () {
9+ __kilt_io__ = IO ::Memory .new
10+ {{ yield }}
11+ __kilt_io__.to_s
12+ }
13+
14+ CONTENT_FOR_BLOCKS [{{key}}] = Tuple .new {{file}}, % proc
15+ nil
16+ end
File renamed without changes.
Original file line number Diff line number Diff line change 1616
1717require " digest/md5"
1818require " file_utils"
19+
20+ # Require kemal, kilt, then our own overrides
1921require " kemal"
22+ require " kilt"
23+ require " ./ext/kemal_content_for.cr"
24+ require " ./ext/kemal_static_file_handler.cr"
25+
2026require " athena-negotiation"
2127require " openssl/hmac"
2228require " option_parser"
Original file line number Diff line number Diff line change @@ -48,13 +48,19 @@ module JSON::Serializable
4848 end
4949end
5050
51- macro templated (filename , template = " template" , navbar_search = true )
51+ macro templated (_filename , template = " template" , navbar_search = true )
5252 navbar_search = {{navbar_search}}
53- render " src/invidious/views/#{ {{filename}} } .ecr" , " src/invidious/views/#{ {{template}} } .ecr"
53+
54+ {{ filename = " src/invidious/views/" + _filename + " .ecr" }}
55+ {{ layout = " src/invidious/views/" + template + " .ecr" }}
56+
57+ __content_filename__ = {{filename}}
58+ content = Kilt .render({{filename}})
59+ Kilt .render({{layout}})
5460end
5561
5662macro rendered (filename )
57- render " src/invidious/views/#{ {{filename}} } .ecr"
63+ Kilt . render( " src/invidious/views/#{ {{filename}} } .ecr" )
5864end
5965
6066# Similar to Kemals halt method but works in a
Original file line number Diff line number Diff line change 5252 <% if ! env.get(" preferences" ).as(Preferences ).thin_mode %>
5353 <div class =" thumbnail" >
5454 <img loading =" lazy" class =" thumbnail" src =" /vi/<%= item.id %> /mqdefault.jpg" />
55- <% if plid = env.get?(" remove_playlist_items" ) %>
56- <form data-onsubmit =" return_false" action =" /playlist_ajax?action_remove_video=1&set_video_id=<%= item.index %> &playlist_id=<%= plid %> &referer=<%= env.get(" current_page" ) %> " method =" post" >
55+ <% if plid_form = env.get?(" remove_playlist_items" ) %>
56+ <form data-onsubmit =" return_false" action =" /playlist_ajax?action_remove_video=1&set_video_id=<%= item.index %> &playlist_id=<%= plid_form %> &referer=<%= env.get(" current_page" ) %> " method =" post" >
5757 <input type =" hidden" name =" csrf_token" value =" <%= HTML .escape(env.get?(" csrf_token" ).try & .as(String ) || " " ) %> " >
5858 <p class =" watched" >
59- <a data-onclick =" remove_playlist_item" data-index =" <%= item.index %> " data-plid =" <%= plid %> " href =" javascript:void(0)" >
59+ <a data-onclick =" remove_playlist_item" data-index =" <%= item.index %> " data-plid =" <%= plid_form %> " href =" javascript:void(0)" >
6060 <button type =" submit" style =" all :unset " >
6161 <i class =" icon ion-md-trash" ></i >
6262 </button >
117117 </a >
118118 </p >
119119 </form >
120- <% elsif plid = env.get? " add_playlist_items" %>
121- <form data-onsubmit =" return_false" action =" /playlist_ajax?action_add_video=1&video_id=<%= item.id %> &playlist_id=<%= plid %> &referer=<%= env.get(" current_page" ) %> " method =" post" >
120+ <% elsif plid_form = env.get? " add_playlist_items" %>
121+ <form data-onsubmit =" return_false" action =" /playlist_ajax?action_add_video=1&video_id=<%= item.id %> &playlist_id=<%= plid_form %> &referer=<%= env.get(" current_page" ) %> " method =" post" >
122122 <input type =" hidden" name =" csrf_token" value =" <%= HTML .escape(env.get?(" csrf_token" ).try & .as(String ) || " " ) %> " >
123123 <p class =" watched" >
124- <a data-onclick =" add_playlist_item" data-id =" <%= item.id %> " data-plid =" <%= plid %> " href =" javascript:void(0)" >
124+ <a data-onclick =" add_playlist_item" data-id =" <%= item.id %> " data-plid =" <%= plid_form %> " href =" javascript:void(0)" >
125125 <button type =" submit" style =" all :unset " >
126126 <i class =" icon ion-md-add" ></i >
127127 </button >
You can’t perform that action at this time.
0 commit comments