From 729427f68e4114a3a289c05a9535d5c02cfd2e21 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Wed, 28 Aug 2024 10:51:03 +0200 Subject: [PATCH] renge/invidious: Require login --- .../invidious/0002-Require-login.patch | 29 +++++++++++++++++++ .../0002-Require-login.patch.license | 4 +++ machines/renge/services/invidious/default.nix | 1 + machines/renge/services/sbruder.xyz/index.md | 1 + 4 files changed, 35 insertions(+) create mode 100644 machines/renge/services/invidious/0002-Require-login.patch create mode 100644 machines/renge/services/invidious/0002-Require-login.patch.license diff --git a/machines/renge/services/invidious/0002-Require-login.patch b/machines/renge/services/invidious/0002-Require-login.patch new file mode 100644 index 0000000..884058b --- /dev/null +++ b/machines/renge/services/invidious/0002-Require-login.patch @@ -0,0 +1,29 @@ +From 9167e70698e82ba9f9c41bff32154bb531322a11 Mon Sep 17 00:00:00 2001 +From: Omar Roth +Date: Wed, 28 Aug 2024 10:34:47 +0200 +Subject: [PATCH 2/2] Require login + +Co-authored-by: Simon Bruder +--- + 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 + diff --git a/machines/renge/services/invidious/0002-Require-login.patch.license b/machines/renge/services/invidious/0002-Require-login.patch.license new file mode 100644 index 0000000..15893f4 --- /dev/null +++ b/machines/renge/services/invidious/0002-Require-login.patch.license @@ -0,0 +1,4 @@ +SPDX-FileCopyrightText: 2019 Omar Roth +SPDX-FileCopyrightText: 2024 Simon Bruder + +SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/machines/renge/services/invidious/default.nix b/machines/renge/services/invidious/default.nix index 9bd509f..b996692 100644 --- a/machines/renge/services/invidious/default.nix +++ b/machines/renge/services/invidious/default.nix @@ -17,6 +17,7 @@ package = pkgs.unstable.invidious.overrideAttrs (o: o // { patches = (o.patches or [ ]) ++ [ ./0001-Prefer-opus-audio-streams-in-listen-mode.patch + ./0002-Require-login.patch ]; }); nginx.enable = true; diff --git a/machines/renge/services/sbruder.xyz/index.md b/machines/renge/services/sbruder.xyz/index.md index 33fd8dd..c1250b1 100644 --- a/machines/renge/services/sbruder.xyz/index.md +++ b/machines/renge/services/sbruder.xyz/index.md @@ -13,6 +13,7 @@ On this domain, the following services are currently available: Because of the increasing hostility of YouTube, the public availability of the Invidious service will be discontinued after **2024-09-27**. 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, please export/transfer your data using the built-in functionality of Invidious.