mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-03 20:14:13 -04:00
Update Kemal to 1.6.0 and remove Kilt (#5120)
This commit is contained in:
commit
df41cb9588
6 changed files with 9 additions and 35 deletions
|
@ -1,16 +0,0 @@
|
|||
# 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
|
|
@ -71,7 +71,7 @@ def send_file(env : HTTP::Server::Context, file_path : String, data : Slice(UInt
|
|||
filesize = data.bytesize
|
||||
attachment(env, filename, disposition)
|
||||
|
||||
Kemal.config.static_headers.try(&.call(env.response, file_path, filestat))
|
||||
Kemal.config.static_headers.try(&.call(env, file_path, filestat))
|
||||
|
||||
file = IO::Memory.new(data)
|
||||
if env.request.method == "GET" && env.request.headers.has_key?("Range")
|
||||
|
|
|
@ -17,10 +17,8 @@
|
|||
require "digest/md5"
|
||||
require "file_utils"
|
||||
|
||||
# Require kemal, kilt, then our own overrides
|
||||
# Require kemal, then our own overrides
|
||||
require "kemal"
|
||||
require "kilt"
|
||||
require "./ext/kemal_content_for.cr"
|
||||
require "./ext/kemal_static_file_handler.cr"
|
||||
|
||||
require "http_proxy"
|
||||
|
@ -226,8 +224,8 @@ error 500 do |env, ex|
|
|||
error_template(500, ex)
|
||||
end
|
||||
|
||||
static_headers do |response|
|
||||
response.headers.add("Cache-Control", "max-age=2629800")
|
||||
static_headers do |env|
|
||||
env.response.headers.add("Cache-Control", "max-age=2629800")
|
||||
end
|
||||
|
||||
# Init Kemal
|
||||
|
|
|
@ -55,12 +55,11 @@ macro templated(_filename, template = "template", navbar_search = true)
|
|||
{{ layout = "src/invidious/views/" + template + ".ecr" }}
|
||||
|
||||
__content_filename__ = {{filename}}
|
||||
content = Kilt.render({{filename}})
|
||||
Kilt.render({{layout}})
|
||||
render {{filename}}, {{layout}}
|
||||
end
|
||||
|
||||
macro rendered(filename)
|
||||
Kilt.render("src/invidious/views/#{{{filename}}}.ecr")
|
||||
render("src/invidious/views/#{{{filename}}}.ecr")
|
||||
end
|
||||
|
||||
# Similar to Kemals halt method but works in a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue