diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 4c0b2686..fa025a73 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -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? diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index bd6fa83d..2767be7f 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -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 %> @@ -104,13 +105,26 @@ - <% if CONFIG.backends %> + <% if !CONFIG.backends.empty? %>
Switch Backend: <% CONFIG.backends.each do | backend | %> - - Backend<%= HTML.escape(backend) %> - | + <% backend = backend.split(CONFIG.backends_delimiter) %> + <% if current_backend == backend[0] %> + + Backend<%= HTML.escape(backend[0]) %> + <% if backend.size == 2 %> + <%= HTML.escape(backend[1]) %> + <% end %> + | + <% else %> + + Backend<%= HTML.escape(backend[0]) %> + <% if backend.size == 2 %> + <%= HTML.escape(backend[1]) %> + <% end %> + | + <% end %> <% end %>
<% end %> @@ -296,6 +310,7 @@