mirror of
https://github.com/iv-org/invidious.git
synced 2025-03-13 09:26:35 -04:00
Merge 05c5448bc137a7798450dec71b0750841bac2c5e into e23d0d13be85c84c53dcdb7dae1566e2a6285d49
This commit is contained in:
commit
6db310e913
@ -18,7 +18,7 @@ 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.2
|
version: 0.4.1
|
||||||
|
|
||||||
http_proxy:
|
http_proxy:
|
||||||
git: https://github.com/mamantoha/http_proxy.git
|
git: https://github.com/mamantoha/http_proxy.git
|
||||||
@ -26,11 +26,7 @@ shards:
|
|||||||
|
|
||||||
kemal:
|
kemal:
|
||||||
git: https://github.com/kemalcr/kemal.git
|
git: https://github.com/kemalcr/kemal.git
|
||||||
version: 1.1.2
|
version: 1.6.0
|
||||||
|
|
||||||
kilt:
|
|
||||||
git: https://github.com/jeromegn/kilt.git
|
|
||||||
version: 0.6.1
|
|
||||||
|
|
||||||
pg:
|
pg:
|
||||||
git: https://github.com/will/crystal-pg.git
|
git: https://github.com/will/crystal-pg.git
|
||||||
|
@ -17,10 +17,7 @@ dependencies:
|
|||||||
version: ~> 0.21.0
|
version: ~> 0.21.0
|
||||||
kemal:
|
kemal:
|
||||||
github: kemalcr/kemal
|
github: kemalcr/kemal
|
||||||
version: ~> 1.1.2
|
version: ~> 1.6.0
|
||||||
kilt:
|
|
||||||
github: jeromegn/kilt
|
|
||||||
version: ~> 0.6.1
|
|
||||||
protodec:
|
protodec:
|
||||||
github: iv-org/protodec
|
github: iv-org/protodec
|
||||||
version: ~> 0.1.5
|
version: ~> 0.1.5
|
||||||
|
@ -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
|
filesize = data.bytesize
|
||||||
attachment(env, filename, disposition)
|
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)
|
file = IO::Memory.new(data)
|
||||||
if env.request.method == "GET" && env.request.headers.has_key?("Range")
|
if env.request.method == "GET" && env.request.headers.has_key?("Range")
|
||||||
|
@ -17,10 +17,8 @@
|
|||||||
require "digest/md5"
|
require "digest/md5"
|
||||||
require "file_utils"
|
require "file_utils"
|
||||||
|
|
||||||
# Require kemal, kilt, then our own overrides
|
# Require kemal, then our own overrides
|
||||||
require "kemal"
|
require "kemal"
|
||||||
require "kilt"
|
|
||||||
require "./ext/kemal_content_for.cr"
|
|
||||||
require "./ext/kemal_static_file_handler.cr"
|
require "./ext/kemal_static_file_handler.cr"
|
||||||
|
|
||||||
require "http_proxy"
|
require "http_proxy"
|
||||||
@ -229,8 +227,8 @@ error 500 do |env, ex|
|
|||||||
error_template(500, ex)
|
error_template(500, ex)
|
||||||
end
|
end
|
||||||
|
|
||||||
static_headers do |response|
|
static_headers do |env|
|
||||||
response.headers.add("Cache-Control", "max-age=2629800")
|
env.response.headers.add("Cache-Control", "max-age=2629800")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Init Kemal
|
# Init Kemal
|
||||||
|
@ -55,12 +55,11 @@ macro templated(_filename, template = "template", navbar_search = true)
|
|||||||
{{ layout = "src/invidious/views/" + template + ".ecr" }}
|
{{ layout = "src/invidious/views/" + template + ".ecr" }}
|
||||||
|
|
||||||
__content_filename__ = {{filename}}
|
__content_filename__ = {{filename}}
|
||||||
content = Kilt.render({{filename}})
|
render {{filename}}, {{layout}}
|
||||||
Kilt.render({{layout}})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
macro rendered(filename)
|
macro rendered(filename)
|
||||||
Kilt.render("src/invidious/views/#{{{filename}}}.ecr")
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user