Backends: Use backend switcher to indicate the current backend in use.
All checks were successful
Invidious CI / build (push) Successful in 6m33s

This commit is contained in:
Fijxu 2024-09-28 20:41:12 -03:00
parent e1a1bf0f79
commit 7f11ebaffd
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
2 changed files with 22 additions and 4 deletions

View file

@ -171,6 +171,9 @@ class Config
# List of names of the backends
property backends : Array(String) = [] of String
# Character used to separate the backend number from the description/note
# of the backend
property backends_delimiter : String = "|"
property external_videoplayback_proxy : String?

View file

@ -1,6 +1,7 @@
<%
locale = env.get("preferences").as(Preferences).locale
dark_mode = env.get("preferences").as(Preferences).dark_mode
current_backend = env.request.cookies["SERVER_ID"]?.try &.value
%>
<!DOCTYPE html>
<html lang="<%= locale %>">
@ -104,13 +105,26 @@
</div>
</div>
<% if CONFIG.backends %>
<% if !CONFIG.backends.empty? %>
<div class="h-box">
<b>Switch Backend:</b>
<% CONFIG.backends.each do | backend | %>
<a href="/switchbackend?backend_id=<%= backend %>">
Backend<%= HTML.escape(backend) %>
</a> |
<% backend = backend.split(CONFIG.backends_delimiter) %>
<% if current_backend == backend[0] %>
<a href="/switchbackend?backend_id=<%= backend[0] %>" style="text-decoration-line: underline; display: inline-block;">
Backend<%= HTML.escape(backend[0]) %>
<% if backend.size == 2 %>
<%= HTML.escape(backend[1]) %>
<% end %>
</a> <span> | </span>
<% else %>
<a href="/switchbackend?backend_id=<%= backend[0] %>" style="display: inline-block;">
Backend<%= HTML.escape(backend[0]) %>
<% if backend.size == 2 %>
<%= HTML.escape(backend[1]) %>
<% end %>
</a> <span> | </span>
<% end %>
<% end %>
</div>
<% end %>
@ -296,6 +310,7 @@
</div>
<hr/>
<div class="footer-footer">
<div class="box">You are currently using Backend: <%= current_backend %></p>
<span class="left">
<% if CONFIG.modified_source_code_url %>
<%= translate(locale, "footer_current_version_modified") %>