From ab862e0d507e65367840075c098a09f7c6f74161 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Mon, 31 Mar 2025 22:47:10 -0300 Subject: [PATCH] fix: restore dmca_content functionality This restores (or adds) the functionality of the `dmca_content` config option that at this date, has been unused and makes no effect. --- locales/en-US.json | 3 ++- src/invidious/routes/watch.cr | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/locales/en-US.json b/locales/en-US.json index 4f2c2770..2712e881 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -501,5 +501,6 @@ "toggle_theme": "Toggle Theme", "carousel_slide": "Slide {{current}} of {{total}}", "carousel_skip": "Skip the Carousel", - "carousel_go_to": "Go to slide `x`" + "carousel_go_to": "Go to slide `x`", + "dmca_content": "Sorry, this video cannot be played on this instance due to a DMCA/copyright infringement letter sent to the instance administrator." } diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index ab588ad6..c589e5e8 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -30,6 +30,10 @@ module Invidious::Routes::Watch return env.redirect "/" end + if CONFIG.dmca_content.includes?(id) + return error_template(403, "dmca_content") + end + plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "") continuation = process_continuation(env.params.query, plid, id)