From 9bc9cc8cabdc1abeb66e3937ba84a7dbb251ff4a Mon Sep 17 00:00:00 2001 From: Fijxu Date: Mon, 31 Mar 2025 22:47:10 -0300 Subject: [PATCH 1/2] 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 3f42a509..3025a0d2 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -502,5 +502,6 @@ "carousel_go_to": "Go to slide `x`", "timeline_parse_error_placeholder_heading": "Unable to parse item", "timeline_parse_error_placeholder_message": "Invidious encountered an error while trying to parse this item. For more information see below:", - "timeline_parse_error_show_technical_details": "Show technical details" + "timeline_parse_error_show_technical_details": "Show technical details", + "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 e777b3f1..13443de3 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) From a218dadad680d40ceee2834f5c7b6507134580ed Mon Sep 17 00:00:00 2001 From: Fijxu Date: Thu, 12 Jun 2025 19:14:25 -0400 Subject: [PATCH 2/2] only disable download widget for dmca video ids --- locales/en-US.json | 2 +- src/invidious/frontend/watch_page.cr | 4 ++++ src/invidious/routes/watch.cr | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/locales/en-US.json b/locales/en-US.json index 3025a0d2..c4326e4d 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -503,5 +503,5 @@ "timeline_parse_error_placeholder_heading": "Unable to parse item", "timeline_parse_error_placeholder_message": "Invidious encountered an error while trying to parse this item. For more information see below:", "timeline_parse_error_show_technical_details": "Show technical details", - "dmca_content": "Sorry, this video cannot be played on this instance due to a DMCA/copyright infringement letter sent to the instance administrator." + "dmca_content": "This video cannot be downloaded on this instance due to a DMCA/copyright infringement letter sent to the instance administrator." } diff --git a/src/invidious/frontend/watch_page.cr b/src/invidious/frontend/watch_page.cr index 15d925e3..df44ddb1 100644 --- a/src/invidious/frontend/watch_page.cr +++ b/src/invidious/frontend/watch_page.cr @@ -23,6 +23,10 @@ module Invidious::Frontend::WatchPage return "

#{translate(locale, "Download is disabled")}

" end + if CONFIG.dmca_content.includes?(video.id) + return "

#{translate(locale, "dmca_content")}

" + end + url = "/download" if (CONFIG.invidious_companion.present?) invidious_companion = CONFIG.invidious_companion.sample diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 13443de3..e777b3f1 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -30,10 +30,6 @@ 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)