Skip to content

Commit 05c5448

Browse files
committed
Update Kemal to 1.6.0 and remove Kilt
Kilt is unmaintained and the ECR templating logic has been natively integrated into Kemal with the issues previously seen having been resolved. This commit is mostly a precursor to support the next Kemal release which will add the ability to create error handlers for raised exceptions. See kemalcr/kemal#688
1 parent 164d764 commit 05c5448

File tree

6 files changed

+9
-35
lines changed

6 files changed

+9
-35
lines changed

shard.lock

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,15 @@ shards:
1818

1919
exception_page:
2020
git: https://github.com/crystal-loot/exception_page.git
21-
version: 0.2.2
21+
version: 0.4.1
2222

2323
http_proxy:
2424
git: https://github.com/mamantoha/http_proxy.git
2525
version: 0.10.3
2626

2727
kemal:
2828
git: https://github.com/kemalcr/kemal.git
29-
version: 1.1.2
30-
31-
kilt:
32-
git: https://github.com/jeromegn/kilt.git
33-
version: 0.6.1
29+
version: 1.6.0
3430

3531
pg:
3632
git: https://github.com/will/crystal-pg.git

shard.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ dependencies:
1717
version: ~> 0.21.0
1818
kemal:
1919
github: kemalcr/kemal
20-
version: ~> 1.1.2
21-
kilt:
22-
github: jeromegn/kilt
23-
version: ~> 0.6.1
20+
version: ~> 1.6.0
2421
protodec:
2522
github: iv-org/protodec
2623
version: ~> 0.1.5

src/ext/kemal_content_for.cr

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/ext/kemal_static_file_handler.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def send_file(env : HTTP::Server::Context, file_path : String, data : Slice(UInt
7171
filesize = data.bytesize
7272
attachment(env, filename, disposition)
7373

74-
Kemal.config.static_headers.try(&.call(env.response, file_path, filestat))
74+
Kemal.config.static_headers.try(&.call(env, file_path, filestat))
7575

7676
file = IO::Memory.new(data)
7777
if env.request.method == "GET" && env.request.headers.has_key?("Range")

src/invidious.cr

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
require "digest/md5"
1818
require "file_utils"
1919

20-
# Require kemal, kilt, then our own overrides
20+
# Require kemal, then our own overrides
2121
require "kemal"
22-
require "kilt"
23-
require "./ext/kemal_content_for.cr"
2422
require "./ext/kemal_static_file_handler.cr"
2523

2624
require "http_proxy"
@@ -221,8 +219,8 @@ error 500 do |env, ex|
221219
error_template(500, ex)
222220
end
223221

224-
static_headers do |response|
225-
response.headers.add("Cache-Control", "max-age=2629800")
222+
static_headers do |env|
223+
env.response.headers.add("Cache-Control", "max-age=2629800")
226224
end
227225

228226
# Init Kemal

src/invidious/helpers/macros.cr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,11 @@ macro templated(_filename, template = "template", navbar_search = true)
5555
{{ layout = "src/invidious/views/" + template + ".ecr" }}
5656

5757
__content_filename__ = {{filename}}
58-
content = Kilt.render({{filename}})
59-
Kilt.render({{layout}})
58+
render {{filename}}, {{layout}}
6059
end
6160

6261
macro rendered(filename)
63-
Kilt.render("src/invidious/views/#{{{filename}}}.ecr")
62+
render("src/invidious/views/#{{{filename}}}.ecr")
6463
end
6564

6665
# Similar to Kemals halt method but works in a

0 commit comments

Comments
 (0)