mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2026-01-16 03:41:23 +00:00
feat: Do not display backends that do not have an i2p equivalent when using i2p
Some checks failed
Stale issue handler / stale (push) Has been cancelled
Build and release container directly from master / release (docker/Dockerfile, AMD64, ubuntu-latest, linux/amd64, ) (push) Has been cancelled
Build and release container directly from master / release (docker/Dockerfile.arm64, ARM64, ubuntu-24.04-arm, linux/arm64/v8, -arm64) (push) Has been cancelled
Invidious CI / build - crystal: 1.14.1, stable: true (push) Has been cancelled
Invidious CI / build - crystal: 1.15.1, stable: true (push) Has been cancelled
Invidious CI / build - crystal: 1.16.3, stable: true (push) Has been cancelled
Invidious CI / build - crystal: 1.17.1, stable: true (push) Has been cancelled
Invidious CI / build - crystal: 1.18.2, stable: true (push) Has been cancelled
Invidious CI / build - crystal: nightly, stable: false (push) Has been cancelled
Invidious CI / Test AMD64 Docker build (push) Has been cancelled
Invidious CI / Test ARM64 Docker build (push) Has been cancelled
Invidious CI / lint (push) Has been cancelled
Some checks failed
Stale issue handler / stale (push) Has been cancelled
Build and release container directly from master / release (docker/Dockerfile, AMD64, ubuntu-latest, linux/amd64, ) (push) Has been cancelled
Build and release container directly from master / release (docker/Dockerfile.arm64, ARM64, ubuntu-24.04-arm, linux/arm64/v8, -arm64) (push) Has been cancelled
Invidious CI / build - crystal: 1.14.1, stable: true (push) Has been cancelled
Invidious CI / build - crystal: 1.15.1, stable: true (push) Has been cancelled
Invidious CI / build - crystal: 1.16.3, stable: true (push) Has been cancelled
Invidious CI / build - crystal: 1.17.1, stable: true (push) Has been cancelled
Invidious CI / build - crystal: 1.18.2, stable: true (push) Has been cancelled
Invidious CI / build - crystal: nightly, stable: false (push) Has been cancelled
Invidious CI / Test AMD64 Docker build (push) Has been cancelled
Invidious CI / Test ARM64 Docker build (push) Has been cancelled
Invidious CI / lint (push) Has been cancelled
This commit is contained in:
@@ -85,8 +85,10 @@ module Invidious::Routes::BeforeAll
|
||||
env.set "current_companion", current_companion
|
||||
|
||||
if host.split(".").last == "i2p"
|
||||
env.set "using_i2p", true
|
||||
env.set "companion_public_url", CONFIG.invidious_companion[current_companion].i2p_public_url.to_s
|
||||
else
|
||||
env.set "using_i2p", false
|
||||
env.set "companion_public_url", CONFIG.invidious_companion[current_companion].public_url.to_s
|
||||
end
|
||||
end
|
||||
|
||||
@@ -114,12 +114,14 @@
|
||||
scheme = env.get("scheme")
|
||||
status = BackendInfo.get_status
|
||||
companion_switched = env.get?("companion_switched")
|
||||
using_i2p = env.get?("using_i2p")
|
||||
%>
|
||||
<div class="h-box" style="margin-bottom: 10px;">
|
||||
<b><%= translate(locale, "companion_switch_backend") %></b>
|
||||
<% if domain %>
|
||||
<% CONFIG.invidious_companion.each_with_index do | companion, index | %>
|
||||
<% next if companion.community && !preferences.show_community_backends %>
|
||||
<% next if companion.i2p_public_url.host.nil? && using_i2p %>
|
||||
<% host_backend = env.request.headers["Host"].sub(/([^.]+)(\d+)/, "\\1#{index+1}") %>
|
||||
<% is_current_backend_host = host_backend == env.request.headers["Host"] %>
|
||||
<a href="<%= scheme %>://<%= host_backend %><%= env.request.resource %>" style="<%= is_current_backend_host ? "text-decoration-line: underline;" : "" %> display: inline-block;">
|
||||
@@ -138,6 +140,7 @@
|
||||
<% current_page = env.get("current_page") %>
|
||||
<% CONFIG.invidious_companion.each_with_index do | companion, index | %>
|
||||
<% next if companion.community && !preferences.show_community_backends %>
|
||||
<% next if companion.i2p_public_url.host.nil? && using_i2p %>
|
||||
<a href="/switchbackend?backend_id=<%= index.to_s %>&referer=<%= current_page %>" style="<%= current_backend == index ? "text-decoration-line: underline;" : "" %> display: inline-block;">
|
||||
<%= HTML.escape(CONFIG.backend_name_prefix + (index + 1).to_s) %> <%= HTML.escape(companion.note) %>
|
||||
<span style="color:
|
||||
|
||||
Reference in New Issue
Block a user