mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-20 13:14:32 -05:00
Merge pull request #2934 from SamantazFox/bump-kemal
Bump kemal dependency to v1.1.2
This commit is contained in:
commit
d0fc2569ff
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -38,9 +38,9 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
stable: [true]
|
stable: [true]
|
||||||
crystal:
|
crystal:
|
||||||
- 1.0.0
|
|
||||||
- 1.1.1
|
|
||||||
- 1.2.2
|
- 1.2.2
|
||||||
|
- 1.3.2
|
||||||
|
- 1.4.0
|
||||||
include:
|
include:
|
||||||
- crystal: nightly
|
- crystal: nightly
|
||||||
stable: false
|
stable: false
|
||||||
|
@ -14,11 +14,11 @@ shards:
|
|||||||
|
|
||||||
exception_page:
|
exception_page:
|
||||||
git: https://github.com/crystal-loot/exception_page.git
|
git: https://github.com/crystal-loot/exception_page.git
|
||||||
version: 0.2.0
|
version: 0.2.2
|
||||||
|
|
||||||
kemal:
|
kemal:
|
||||||
git: https://github.com/kemalcr/kemal.git
|
git: https://github.com/kemalcr/kemal.git
|
||||||
version: 1.1.0
|
version: 1.1.2
|
||||||
|
|
||||||
kilt:
|
kilt:
|
||||||
git: https://github.com/jeromegn/kilt.git
|
git: https://github.com/jeromegn/kilt.git
|
||||||
|
@ -18,7 +18,10 @@ dependencies:
|
|||||||
version: ~> 0.18.0
|
version: ~> 0.18.0
|
||||||
kemal:
|
kemal:
|
||||||
github: kemalcr/kemal
|
github: kemalcr/kemal
|
||||||
version: ~> 1.1.0
|
version: ~> 1.1.2
|
||||||
|
kilt:
|
||||||
|
github: jeromegn/kilt
|
||||||
|
version: ~> 0.6.1
|
||||||
protodec:
|
protodec:
|
||||||
github: iv-org/protodec
|
github: iv-org/protodec
|
||||||
version: ~> 0.1.4
|
version: ~> 0.1.4
|
||||||
|
16
src/ext/kemal_content_for.cr
Normal file
16
src/ext/kemal_content_for.cr
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Overrides for Kemal's `content_for` macro in order to keep using
|
||||||
|
# kilt as it was before Kemal v1.1.1 (Kemal PR #618).
|
||||||
|
|
||||||
|
require "kemal"
|
||||||
|
require "kilt"
|
||||||
|
|
||||||
|
macro content_for(key, file = __FILE__)
|
||||||
|
%proc = ->() {
|
||||||
|
__kilt_io__ = IO::Memory.new
|
||||||
|
{{ yield }}
|
||||||
|
__kilt_io__.to_s
|
||||||
|
}
|
||||||
|
|
||||||
|
CONTENT_FOR_BLOCKS[{{key}}] = Tuple.new {{file}}, %proc
|
||||||
|
nil
|
||||||
|
end
|
@ -16,7 +16,13 @@
|
|||||||
|
|
||||||
require "digest/md5"
|
require "digest/md5"
|
||||||
require "file_utils"
|
require "file_utils"
|
||||||
|
|
||||||
|
# Require kemal, kilt, then our own overrides
|
||||||
require "kemal"
|
require "kemal"
|
||||||
|
require "kilt"
|
||||||
|
require "./ext/kemal_content_for.cr"
|
||||||
|
require "./ext/kemal_static_file_handler.cr"
|
||||||
|
|
||||||
require "athena-negotiation"
|
require "athena-negotiation"
|
||||||
require "openssl/hmac"
|
require "openssl/hmac"
|
||||||
require "option_parser"
|
require "option_parser"
|
||||||
|
@ -48,13 +48,19 @@ module JSON::Serializable
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
macro templated(filename, template = "template", navbar_search = true)
|
macro templated(_filename, template = "template", navbar_search = true)
|
||||||
navbar_search = {{navbar_search}}
|
navbar_search = {{navbar_search}}
|
||||||
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr"
|
|
||||||
|
{{ filename = "src/invidious/views/" + _filename + ".ecr" }}
|
||||||
|
{{ layout = "src/invidious/views/" + template + ".ecr" }}
|
||||||
|
|
||||||
|
__content_filename__ = {{filename}}
|
||||||
|
content = Kilt.render({{filename}})
|
||||||
|
Kilt.render({{layout}})
|
||||||
end
|
end
|
||||||
|
|
||||||
macro rendered(filename)
|
macro rendered(filename)
|
||||||
render "src/invidious/views/#{{{filename}}}.ecr"
|
Kilt.render("src/invidious/views/#{{{filename}}}.ecr")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Similar to Kemals halt method but works in a
|
# Similar to Kemals halt method but works in a
|
||||||
|
@ -52,11 +52,11 @@
|
|||||||
<% if !env.get("preferences").as(Preferences).thin_mode %>
|
<% if !env.get("preferences").as(Preferences).thin_mode %>
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
<img loading="lazy" class="thumbnail" src="/vi/<%= item.id %>/mqdefault.jpg"/>
|
<img loading="lazy" class="thumbnail" src="/vi/<%= item.id %>/mqdefault.jpg"/>
|
||||||
<% if plid = env.get?("remove_playlist_items") %>
|
<% if plid_form = env.get?("remove_playlist_items") %>
|
||||||
<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">
|
<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">
|
||||||
<input type="hidden" name="csrf_token" value="<%= HTML.escape(env.get?("csrf_token").try &.as(String) || "") %>">
|
<input type="hidden" name="csrf_token" value="<%= HTML.escape(env.get?("csrf_token").try &.as(String) || "") %>">
|
||||||
<p class="watched">
|
<p class="watched">
|
||||||
<a data-onclick="remove_playlist_item" data-index="<%= item.index %>" data-plid="<%= plid %>" href="javascript:void(0)">
|
<a data-onclick="remove_playlist_item" data-index="<%= item.index %>" data-plid="<%= plid_form %>" href="javascript:void(0)">
|
||||||
<button type="submit" style="all:unset">
|
<button type="submit" style="all:unset">
|
||||||
<i class="icon ion-md-trash"></i>
|
<i class="icon ion-md-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -117,11 +117,11 @@
|
|||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
<% elsif plid = env.get? "add_playlist_items" %>
|
<% elsif plid_form = env.get? "add_playlist_items" %>
|
||||||
<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">
|
<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">
|
||||||
<input type="hidden" name="csrf_token" value="<%= HTML.escape(env.get?("csrf_token").try &.as(String) || "") %>">
|
<input type="hidden" name="csrf_token" value="<%= HTML.escape(env.get?("csrf_token").try &.as(String) || "") %>">
|
||||||
<p class="watched">
|
<p class="watched">
|
||||||
<a data-onclick="add_playlist_item" data-id="<%= item.id %>" data-plid="<%= plid %>" href="javascript:void(0)">
|
<a data-onclick="add_playlist_item" data-id="<%= item.id %>" data-plid="<%= plid_form %>" href="javascript:void(0)">
|
||||||
<button type="submit" style="all:unset">
|
<button type="submit" style="all:unset">
|
||||||
<i class="icon ion-md-add"></i>
|
<i class="icon ion-md-add"></i>
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user