renge/invidious: Require login

This commit is contained in:
Simon Bruder 2024-08-28 10:51:03 +02:00
parent cce1211048
commit 729427f68e
Signed by: simon
GPG key ID: 347FF8699CDA0776
4 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,29 @@
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

View file

@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2019 Omar Roth <omarroth@protonmail.com>
SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
SPDX-License-Identifier: AGPL-3.0-or-later

View file

@ -17,6 +17,7 @@
package = pkgs.unstable.invidious.overrideAttrs (o: o // { package = pkgs.unstable.invidious.overrideAttrs (o: o // {
patches = (o.patches or [ ]) ++ [ patches = (o.patches or [ ]) ++ [
./0001-Prefer-opus-audio-streams-in-listen-mode.patch ./0001-Prefer-opus-audio-streams-in-listen-mode.patch
./0002-Require-login.patch
]; ];
}); });
nginx.enable = true; nginx.enable = true;

View file

@ -13,6 +13,7 @@ On this domain, the following services are currently available:
Because of the increasing hostility of YouTube, Because of the increasing hostility of YouTube,
the public availability of the Invidious service will be discontinued after **2024-09-27**. the public availability of the Invidious service will be discontinued after **2024-09-27**.
Registration of new accounts is disabled since **2024-08-22**. Registration of new accounts is disabled since **2024-08-22**.
Access by unauthenticated users is disabled since **2024-08-28**.
If you have an account, If you have an account,
please export/transfer your data using the built-in functionality of Invidious. please export/transfer your data using the built-in functionality of Invidious.