Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Kemal to 1.6.0 and remove Kilt #5120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@ shards:

exception_page:
git: https://github.com/crystal-loot/exception_page.git
version: 0.2.2
version: 0.4.1

http_proxy:
git: https://github.com/mamantoha/http_proxy.git
version: 0.10.3

kemal:
git: https://github.com/kemalcr/kemal.git
version: 1.1.2

kilt:
git: https://github.com/jeromegn/kilt.git
version: 0.6.1
version: 1.6.0

pg:
git: https://github.com/will/crystal-pg.git
Expand Down
5 changes: 1 addition & 4 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ dependencies:
version: ~> 0.21.0
kemal:
github: kemalcr/kemal
version: ~> 1.1.2
kilt:
github: jeromegn/kilt
version: ~> 0.6.1
version: ~> 1.6.0
protodec:
github: iv-org/protodec
version: ~> 0.1.5
Expand Down
16 changes: 0 additions & 16 deletions src/ext/kemal_content_for.cr

This file was deleted.

2 changes: 1 addition & 1 deletion src/ext/kemal_static_file_handler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 3 additions & 5 deletions src/invidious.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -221,8 +219,8 @@
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
Expand All @@ -249,4 +247,4 @@
Kemal.config.env = "production" if !ENV.has_key?("KEMAL_ENV")
{% end %}

Kemal.run

Check failure on line 250 in src/invidious.cr

View workflow job for this annotation

GitHub Actions / build - crystal: 1.10.1, stable: true

instantiating 'Kemal.run()'

Check failure on line 250 in src/invidious.cr

View workflow job for this annotation

GitHub Actions / build - crystal: 1.11.2, stable: true

instantiating 'Kemal.run()'
5 changes: 2 additions & 3 deletions src/invidious/helpers/macros.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading