Disable switching to unhealthy backends

This commit is contained in:
Sommerwiesel
2025-06-21 13:22:10 +02:00
parent a1f19a0cfe
commit 0b953aa3a8
@@ -0,0 +1,30 @@
diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr
index 413cfc22..347ca227 100644
--- a/src/invidious/views/template.ecr
+++ b/src/invidious/views/template.ecr
@@ -120,13 +120,18 @@
<% end %>
<% current_page = env.get("current_page") %>
<% CONFIG.invidious_companion.each_with_index do | companion, index | %>
- <a href="/switchbackend?backend_id=<%= index.to_s %>&referer=<%= current_page %>" style="<%= current_backend == index ? "text-decoration-line: underline; font-weight:bold;" : "" %> display: inline-block;">
- <%= HTML.escape(CONFIG.backend_name_prefix + (index + 1).to_s) %> <%= HTML.escape(companion.note) %>
- <span style="font-size: 1rem; color:
- <% if status[index] == BackendInfo::Status::Dead.to_i %> #fd4848; <% end %>
- <% if status[index] == BackendInfo::Status::Working.to_i %> #42ae3c; <% end %>
- ">•</span>
- </a>
+ <% if status[index] == BackendInfo::Status::Working.to_i %>
+ <a href="/switchbackend?backend_id=<%= index.to_s %>&referer=<%= current_page %>" style="<%= current_backend == index ? "text-decoration-line: underline; font-weight:bold;" : "" %> display: inline-block;">
+ <%= HTML.escape(CONFIG.backend_name_prefix + (index + 1).to_s) %> <%= HTML.escape(companion.note) %>
+ <span style="font-size: 1rem; color: #42ae3c; ">•</span>
+ </a>
+ <% end %>
+ <% if status[index] == BackendInfo::Status::Dead.to_i %>
+ <span style="cursor: not-allowed;<%= current_backend == index ? " text-decoration-line: underline; font-weight:bold;" : "" %> display: inline-block;">
+ <%= HTML.escape(CONFIG.backend_name_prefix + (index + 1).to_s) %> <%= HTML.escape(companion.note) %>
+ <span style="font-size: 1rem; color: #fd4848; ">•</span>
+ </span>
+ <% end %>
<% if !(index == CONFIG.invidious_companion.size-1) %>
<span> | </span>
<% end %>