From b3637f20a9373a6580d377ff9e42be95fae18e84 Mon Sep 17 00:00:00 2001 From: John Wong Date: Mon, 10 Apr 2023 10:58:11 +0800 Subject: [PATCH] check the config flag first --- src/invidious/routes/before_all.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/routes/before_all.cr b/src/invidious/routes/before_all.cr index 24582bd5..64430d83 100644 --- a/src/invidious/routes/before_all.cr +++ b/src/invidious/routes/before_all.cr @@ -150,7 +150,7 @@ module Invidious::Routes::BeforeAll env.set "current_page", URI.encode_www_form(current_page) unregistered_path_whitelist = {"/", "/login", "/licenses", "/privacy"} - if !env.get?("user") && !unregistered_path_whitelist.includes?(env.request.path) && CONFIG.login_only + 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