30 lines
928 B
Diff
30 lines
928 B
Diff
From 9167e70698e82ba9f9c41bff32154bb531322a11 Mon Sep 17 00:00:00 2001
|
|
From: Omar Roth <omarroth@protonmail.com>
|
|
Date: Wed, 28 Aug 2024 10:34:47 +0200
|
|
Subject: [PATCH 2/2] Require login
|
|
|
|
Co-authored-by: Simon Bruder <simon@sbruder.de>
|
|
---
|
|
src/invidious/routes/before_all.cr | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/src/invidious/routes/before_all.cr b/src/invidious/routes/before_all.cr
|
|
index 5695dee9..c981a463 100644
|
|
--- a/src/invidious/routes/before_all.cr
|
|
+++ b/src/invidious/routes/before_all.cr
|
|
@@ -122,5 +122,11 @@ module Invidious::Routes::BeforeAll
|
|
end
|
|
|
|
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)
|
|
+ env.response.headers["Location"] = "/login"
|
|
+ haltf env, status_code: 302
|
|
+ end
|
|
end
|
|
end
|
|
--
|
|
2.44.1
|
|
|