From 24858d7afac0083434be07a25cd79c5c74b57dd7 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Mon, 25 Mar 2019 09:31:51 -0500 Subject: [PATCH] Add missing context_type --- src/invidious.cr | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/invidious.cr b/src/invidious.cr index 23248c6a9..6f023f089 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -86,6 +86,8 @@ statistics = { "error" => "Statistics are not availabile.", } +proxies = PROXY_LIST + decrypt_function = [] of {name: String, value: Int32} spawn do update_decrypt_function do |function| @@ -99,9 +101,14 @@ before_all do |env| env.response.headers["X-XSS-Protection"] = "1; mode=block;" env.response.headers["X-Content-Type-Options"] = "nosniff" + preferences = DEFAULT_USER_PREFERENCES.dup + locale = env.params.query["hl"]? locale ||= "en-US" - env.set "locale", locale + + preferences.locale = locale + + env.set "preferences", preferences end # API Endpoints @@ -1904,7 +1911,11 @@ if Kemal.config.ssl end Kemal.config.powered_by_header = false +add_handler FilteredCompressHandler.new add_handler APIHandler.new +add_handler DenyFrame.new +add_context_storage_type(User) +add_context_storage_type(Preferences) Kemal.config.logger = logger Kemal.run