mirror of
https://git.nerdvpn.de/NerdVPN.de/invidious
synced 2026-02-14 22:51:42 +01:00
Add local proxy patch, remoge watch msg
This commit is contained in:
@@ -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
|
||||
- ">•</span>
|
||||
- </a>
|
||||
+ <% if status[index] == BackendInfo::Status::Working.to_i %>
|
||||
+ <a class="backend backend-healthy<%= current_backend == index ? " backend-selected" : "" %>" href="/switchbackend?backend_id=<%= index.to_s %>&referer=<%= current_page %>">
|
||||
+ <a class="backend backend-healthy backend_number_<%= index %><%= current_backend == index ? " backend-selected" : "" %>" href="/switchbackend?backend_id=<%= index.to_s %>&referer=<%= current_page %>">
|
||||
+ <%= HTML.escape(CONFIG.backend_name_prefix + (index + 1).to_s) %> <%= HTML.escape(companion.note) %>
|
||||
+ <span class="backend-status">•</span>
|
||||
+ </a>
|
||||
+ <% end %>
|
||||
+ <% if status[index] == BackendInfo::Status::Dead.to_i %>
|
||||
+ <span class="backend backend-unhealthy<%= current_backend == index ? " backend-selected" : "" %>">
|
||||
+ <span class="backend backend-unhealthy backend_number_<%= index %><%= current_backend == index ? " backend-selected" : "" %>">
|
||||
+ <%= HTML.escape(CONFIG.backend_name_prefix + (index + 1).to_s) %> <%= HTML.escape(companion.note) %>
|
||||
+ <span class="backend-status">•</span>
|
||||
+ </span>
|
||||
|
||||
@@ -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 @@
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="local"><%= translate(locale, "preferences_local_label") %></label>
|
||||
- <input name="local" id="local" type="checkbox" <% if preferences.local && !CONFIG.disabled?("local") %>checked<% end %> <% if CONFIG.disabled?("local") %>disabled<% end %>>
|
||||
+ <input name="local" id="local" type="checkbox" <% if CONFIG.force_local %>disabled="" checked<% elsif preferences.local && !CONFIG.disabled?("local") %>checked<% elsif CONFIG.disabled?("local") %>disabled<% end %>>
|
||||
+ <% if CONFIG.force_local %>
|
||||
+ <label for="local">(All videos are proxied by default)</label>
|
||||
+ <% end %>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
Reference in New Issue
Block a user