diff --git a/patches/018-add-watch-message.patch b/patches/018-add-watch-message.patch.d similarity index 100% rename from patches/018-add-watch-message.patch rename to patches/018-add-watch-message.patch.d diff --git a/patches/020-disable-switching-to-unhealthy-backends.patch b/patches/020-disable-switching-to-unhealthy-backends.patch index 380adc5..429d5d4 100644 --- a/patches/020-disable-switching-to-unhealthy-backends.patch +++ b/patches/020-disable-switching-to-unhealthy-backends.patch @@ -1,5 +1,5 @@ diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr -index 413cfc22..af006ba9 100644 +index 413cfc22..261a9d39 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -120,15 +120,20 @@ @@ -14,13 +14,13 @@ index 413cfc22..af006ba9 100644 - ">• - + <% if status[index] == BackendInfo::Status::Working.to_i %> -+ " href="/switchbackend?backend_id=<%= index.to_s %>&referer=<%= current_page %>"> ++ " href="/switchbackend?backend_id=<%= index.to_s %>&referer=<%= current_page %>"> + <%= HTML.escape(CONFIG.backend_name_prefix + (index + 1).to_s) %> <%= HTML.escape(companion.note) %> + + + <% end %> + <% if status[index] == BackendInfo::Status::Dead.to_i %> -+ "> ++ "> + <%= HTML.escape(CONFIG.backend_name_prefix + (index + 1).to_s) %> <%= HTML.escape(companion.note) %> + + diff --git a/patches/021-add-option-to-force-local-proxy.patch b/patches/021-add-option-to-force-local-proxy.patch new file mode 100644 index 0000000..d40d052 --- /dev/null +++ b/patches/021-add-option-to-force-local-proxy.patch @@ -0,0 +1,69 @@ +diff --git a/src/invidious/config.cr b/src/invidious/config.cr +index ace58208..9f07f16a 100644 +--- a/src/invidious/config.cr ++++ b/src/invidious/config.cr +@@ -143,6 +143,7 @@ class Config + property hsts : Bool? = true + # Disable proxying server-wide: options: 'dash', 'livestreams', 'downloads', 'local' + property disable_proxy : Bool? | Array(String)? = false ++ property force_local : Bool = true + # Enable the user notifications for all users + property enable_user_notifications : Bool = true + +diff --git a/src/invidious/routes/before_all.cr b/src/invidious/routes/before_all.cr +index 6fb2eef4..a8c53cff 100644 +--- a/src/invidious/routes/before_all.cr ++++ b/src/invidious/routes/before_all.cr +@@ -149,20 +149,7 @@ module Invidious::Routes::BeforeAll + preferences.locale = locale + env.set "preferences", preferences + +- # Allow media resources to be loaded from google servers +- # TODO: check if *.youtube.com can be removed +- # +- # `!preferences.local` has to be checked after setting and +- # reading `preferences` from the "PREFS" cookie and +- # saved user preferences from the database, otherwise +- # `https://*.googlevideo.com:443 https://*.youtube.com:443` +- # will not be set in the CSP header if +- # `default_user_preferences.local` is set to true on the +- # configuration file, causing preference “Proxy Videos” +- # not to work while having it disabled and using medium quality. +- if CONFIG.disabled?("local") || !preferences.local +- env.response.headers["Content-Security-Policy"] = env.response.headers["Content-Security-Policy"].gsub("media-src", "media-src https://*.googlevideo.com:443 https://*.youtube.com:443") +- end ++ env.response.headers["Content-Security-Policy"] = env.response.headers["Content-Security-Policy"].gsub("media-src", "media-src https://*.googlevideo.com:443 https://*.youtube.com:443") + + current_page = env.request.path + if env.request.query +diff --git a/src/invidious/videos/video_preferences.cr b/src/invidious/videos/video_preferences.cr +index 48177bd8..843ef30f 100644 +--- a/src/invidious/videos/video_preferences.cr ++++ b/src/invidious/videos/video_preferences.cr +@@ -109,7 +109,9 @@ def process_video_params(query, preferences) + quality = "high" + end + +- if CONFIG.disabled?("local") && local ++ if CONFIG.force_local ++ local = true ++ elsif CONFIG.disabled?("local") && local + local = false + end + +diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr +index 83847bea..0b21bb69 100644 +--- a/src/invidious/views/user/preferences.ecr ++++ b/src/invidious/views/user/preferences.ecr +@@ -34,7 +34,10 @@ + +
+ +- checked<% end %> <% if CONFIG.disabled?("local") %>disabled<% end %>> ++ disabled="" checked<% elsif preferences.local && !CONFIG.disabled?("local") %>checked<% elsif CONFIG.disabled?("local") %>disabled<% end %>> ++ <% if CONFIG.force_local %> ++ ++ <% end %> +
+ +