From f5244055a27bb0be81e71781e39fc43ce0a14eb5 Mon Sep 17 00:00:00 2001 From: kaka Date: Sat, 15 Jul 2023 06:57:37 +0800 Subject: [PATCH] @SamantazFox: Put that code before return if (on line 64) --- src/invidious/routes/before_all.cr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/invidious/routes/before_all.cr b/src/invidious/routes/before_all.cr index ea1af277..495ec57b 100644 --- a/src/invidious/routes/before_all.cr +++ b/src/invidious/routes/before_all.cr @@ -61,6 +61,12 @@ module Invidious::Routes::BeforeAll env.response.headers["Strict-Transport-Security"] = "max-age=31536000; includeSubDomains; preload" end + unregistered_path_whitelist = {"/", "/login", "/licenses", "/privacy"} + if CONFIG.login_only && !env.get?("user") && !unregistered_path_whitelist.includes?(env.request.path) + env.response.headers["Location"] = "/login" + haltf env, status_code: 302 + end + return if { "/sb/", "/vi/", @@ -122,11 +128,5 @@ module Invidious::Routes::BeforeAll end env.set "current_page", URI.encode_www_form(current_page) - - unregistered_path_whitelist = {"/", "/login", "/licenses", "/privacy"} - if CONFIG.login_only && !env.get?("user") && !unregistered_path_whitelist.includes?(env.request.path) - env.response.headers["Location"] = "/login" - haltf env, status_code: 302 - end end end