Allow automatic instance redirect to be turned off

Instead the "switch invidious instance" link would bring users to
redirect.invidious.io
This commit is contained in:
syeopite 2021-05-15 20:08:33 -07:00
parent cf72b34866
commit b63bebb519
No known key found for this signature in database
GPG Key ID: 6FA616E5A5294A82
41 changed files with 97 additions and 6 deletions

View File

@ -86,6 +86,8 @@
"dark": "غامق (اسود)",
"light": "فاتح (ابيض)",
"Thin mode: ": "الوضع الخفيف: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "تفضيلات الإشتراك",
"Show annotations by default for subscribed channels: ": "عرض الملاحظات في الفيديوهات تلقائيا في القنوات المشترك بها فقط: ",
"Redirect homepage to feed: ": "إعادة التوجية من الصفحة الرئيسية لصفحة المشتركين (لرؤية اخر فيديوهات المشتركين): ",

View File

@ -80,6 +80,8 @@
"dark": "",
"light": "",
"Thin mode: ": "",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "",
"Show annotations by default for subscribed channels: ": "",
"Redirect homepage to feed: ": "",

View File

@ -86,6 +86,8 @@
"dark": "tmavý",
"light": "světlý",
"Thin mode: ": "Kompaktní režim: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Nastavení předplatných",
"Show annotations by default for subscribed channels: ": "Ve výchozím nastavení zobrazovat poznámky u odebíraných kanálů: ",
"Redirect homepage to feed: ": "Přesměrovávat domovskou stránku na informační kanál: ",

View File

@ -86,6 +86,8 @@
"dark": "mørk",
"light": "lys",
"Thin mode: ": "Tynd tilstand: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Abonnements præferencer",
"Show annotations by default for subscribed channels: ": "Vis annotationer som standard for abonnerede kanaler: ",
"Redirect homepage to feed: ": "Omdiriger startside til feed: ",

View File

@ -86,6 +86,8 @@
"dark": "Nachtmodus",
"light": "heller Modus",
"Thin mode: ": "Schlanker Modus: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Abonnementeinstellungen",
"Show annotations by default for subscribed channels: ": "Anmerkungen für abonnierte Kanäle standardmäßig anzeigen? ",
"Redirect homepage to feed: ": "Startseite zu Feed umleiten: ",

View File

@ -86,6 +86,8 @@
"dark": "σκοτεινό",
"light": "φωτεινό",
"Thin mode: ": "Ελαφριά λειτουργία: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Προτιμήσεις συνδρομών",
"Show annotations by default for subscribed channels: ": "Προβολή σημειώσεων μόνο για κανάλια στα οποία είστε συνδρομητής; ",
"Redirect homepage to feed: ": "Ανακατεύθυνση αρχικής στη ροή συνδρομών: ",

View File

@ -86,6 +86,8 @@
"dark": "dark",
"light": "light",
"Thin mode: ": "Thin mode: ",
"Miscellaneous preferences": "Miscellaneous preferences",
"Automatically redirect to another Instance: ": "Automatically redirect to another Instance: ",
"Subscription preferences": "Subscription preferences",
"Show annotations by default for subscribed channels: ": "Show annotations by default for subscribed channels? ",
"Redirect homepage to feed: ": "Redirect homepage to feed: ",

View File

@ -86,6 +86,8 @@
"dark": "malhela",
"light": "hela",
"Thin mode: ": "Maldika reĝimo: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Abonaj agordoj",
"Show annotations by default for subscribed channels: ": "Ĉu montri prinotojn defaŭlte por abonitaj kanaloj? ",
"Redirect homepage to feed: ": "Alidirekti hejmpâgon al fluo: ",

View File

@ -86,6 +86,8 @@
"dark": "oscuro",
"light": "claro",
"Thin mode: ": "Modo compacto: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Preferencias de la suscripción",
"Show annotations by default for subscribed channels: ": "¿Mostrar anotaciones por defecto para los canales suscritos? ",
"Redirect homepage to feed: ": "Redirigir la página de inicio a la fuente: ",

View File

@ -77,6 +77,8 @@
"dark": "iluna",
"light": "argia",
"Thin mode: ": "",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Harpidetzen hobespenak",
"Show annotations by default for subscribed channels: ": "",
"Redirect homepage to feed: ": "",

View File

@ -86,6 +86,8 @@
"dark": "تاریک",
"light": "روشن",
"Thin mode: ": "حالت نازک: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "ترجیحات اشتراک",
"Show annotations by default for subscribed channels: ": "نمایش حاشیه نویسی ها به طور پیشفرض برای کانال های مشترک شده: ",
"Redirect homepage to feed: ": "تغییر مسیر صفحه خانه به خوراک: ",

View File

@ -86,6 +86,8 @@
"dark": "tumma",
"light": "vaalea",
"Thin mode: ": "Kapea tila ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Tilausten asetukset",
"Show annotations by default for subscribed channels: ": "Näytä oletuksena tilattujen kanavien huomautukset: ",
"Redirect homepage to feed: ": "Uudelleenohjaa kotisivu syötteeseen: ",

View File

@ -87,6 +87,8 @@
"light": "clair",
"Thin mode: ": "Mode léger : ",
"Subscription preferences": "Préférences des abonnements",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Show annotations by default for subscribed channels: ": "Afficher les annotations par défaut sur les chaînes auxquelles vous êtes abonnés : ",
"Redirect homepage to feed: ": "Rediriger la page d'accueil vers la page d'abonnements : ",
"Number of videos shown in feed: ": "Nombre de vidéos affichées dans la page d'abonnements : ",

View File

@ -86,6 +86,8 @@
"dark": "כהה",
"light": "בהיר",
"Thin mode: ": "",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "העדפות מינויים",
"Show annotations by default for subscribed channels: ": "Show annotations by default for subscribed channels? ",
"Redirect homepage to feed: ": "",

View File

@ -86,6 +86,8 @@
"dark": "tamno",
"light": "svijetlo",
"Thin mode: ": "Pojednostavljen prikaz: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Postavke pretplata",
"Show annotations by default for subscribed channels: ": "Standardno prikaži napomene za pretplaćene kanale: ",
"Redirect homepage to feed: ": "Preusmjeri početnu stranicu na feed: ",

View File

@ -77,6 +77,8 @@
"dark": "sötét",
"light": "világos",
"Thin mode: ": "Vékony mód: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Feliratkozási beállítások",
"Show annotations by default for subscribed channels: ": "Szövegmagyarázatok mutatása alapértelmezésben feliratkozott csatornák esetében: ",
"Redirect homepage to feed: ": "Kezdő oldal átirányitása a feed-re: ",

View File

@ -86,6 +86,8 @@
"dark": "gelap",
"light": "terang",
"Thin mode: ": "Mode tipis: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Preferensi langganan",
"Show annotations by default for subscribed channels: ": "Tampilkan anotasi secara default untuk kanal langganan: ",
"Redirect homepage to feed: ": "Arahkan kembali laman beranda ke umpan: ",

View File

@ -86,6 +86,8 @@
"dark": "dimmt",
"light": "ljóst",
"Thin mode: ": "Þunnt ham: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Áskriftarstillingar",
"Show annotations by default for subscribed channels: ": "Á að sýna glósur sjálfgefið fyrir áskriftarrásir? ",
"Redirect homepage to feed: ": "Endurbeina heimasíðu að straumi: ",

View File

@ -86,6 +86,8 @@
"dark": "scuro",
"light": "chiaro",
"Thin mode: ": "Modalità per connessioni lente: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Preferenze iscrizioni",
"Show annotations by default for subscribed channels: ": "Mostrare annotazioni in modo predefinito per i canali sottoscritti: ",
"Redirect homepage to feed: ": "Reindirizza la pagina principale a quella delle iscrizioni: ",

View File

@ -86,6 +86,8 @@
"dark": "ダーク",
"light": "ライト",
"Thin mode: ": "最小モード: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "登録チャンネル設定",
"Show annotations by default for subscribed channels: ": "デフォルトで登録チャンネルのアノテーションを表示しますか? ",
"Redirect homepage to feed: ": "ホームからフィードにリダイレクト: ",

View File

@ -86,6 +86,8 @@
"dark": "Mørk",
"light": "Lys",
"Thin mode: ": "Tynt modus: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Abonnementsinnstillinger",
"Show annotations by default for subscribed channels: ": "Vis merknader som forvalg for kanaler det abonneres på? ",
"Redirect homepage to feed: ": "Videresend hjemmeside til kilde: ",

View File

@ -86,6 +86,8 @@
"dark": "donker",
"light": "licht",
"Thin mode: ": "Smalle modus: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Abonnementsinstellingen",
"Show annotations by default for subscribed channels: ": "Standaard annotaties tonen voor geabonneerde kanalen? ",
"Redirect homepage to feed: ": "Startpagina omleiden naar feed: ",

View File

@ -86,6 +86,8 @@
"dark": "ciemny",
"light": "jasny",
"Thin mode: ": "Tryb minimalny: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Preferencje subskrybcji",
"Show annotations by default for subscribed channels: ": "Domyślnie wyświetlaj adnotacje dla subskrybowanych kanałów: ",
"Redirect homepage to feed: ": "Przekieruj stronę główną do subskrybcji: ",

View File

@ -86,6 +86,8 @@
"dark": "escuro",
"light": "claro",
"Thin mode: ": "Modo compacto: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Preferências de inscrições",
"Show annotations by default for subscribed channels: ": "Sempre mostrar anotações dos vídeos de canais inscritos: ",
"Redirect homepage to feed: ": "Redirecionar página inicial para o feed: ",

View File

@ -86,6 +86,8 @@
"dark": "escuro",
"light": "claro",
"Thin mode: ": "Modo compacto: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Preferências de subscrições",
"Show annotations by default for subscribed channels: ": "Mostrar sempre anotações aos canais subscritos: ",
"Redirect homepage to feed: ": "Redirecionar página inicial para subscrições: ",

View File

@ -86,6 +86,8 @@
"dark": "întunecat",
"light": "luminos",
"Thin mode: ": "Mod lejer: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Preferințele paginii de abonamente",
"Show annotations by default for subscribed channels: ": "Afișați adnotările în mod implicit pentru canalele la care v-ați abonat: ",
"Redirect homepage to feed: ": "Redirecționați pagina principală la pagina de abonamente: ",

View File

@ -86,6 +86,8 @@
"dark": "темная",
"light": "светлая",
"Thin mode: ": "Облегчённое оформление: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Настройки подписок",
"Show annotations by default for subscribed channels: ": "Всегда показывать аннотации в видео каналов, на которые вы подписаны? ",
"Redirect homepage to feed: ": "Отображать видео с каналов, на которые вы подписаны, как главную страницу: ",

View File

@ -86,6 +86,8 @@
"dark": "",
"light": "",
"Thin mode: ": "",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "",
"Show annotations by default for subscribed channels: ": "",
"Redirect homepage to feed: ": "",

View File

@ -80,6 +80,8 @@
"dark": "tmavá",
"light": "svetlá",
"Thin mode: ": "Tenký režim: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Nastavenia predplatného",
"Show annotations by default for subscribed channels: ": "Predvolene zobraziť anotácie odoberaných kanálov: ",
"Redirect homepage to feed: ": "Presmerovanie domovskej stránky na informačný kanál: ",

View File

@ -86,6 +86,8 @@
"dark": "",
"light": "",
"Thin mode: ": "",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "",
"Show annotations by default for subscribed channels: ": "",
"Redirect homepage to feed: ": "",

View File

@ -77,6 +77,8 @@
"dark": "тамна",
"light": "светла",
"Thin mode: ": "Узани режим: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Подешавања о праћењима",
"Show annotations by default for subscribed channels: ": "Увек приказуј анотације за канале које пратим: ",
"Redirect homepage to feed: ": "Прикажи праћења као почетну страницу: ",

View File

@ -86,6 +86,8 @@
"dark": "Mörkt",
"light": "Ljust",
"Thin mode: ": "Lättviktigt läge: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Prenumerationsinställningar",
"Show annotations by default for subscribed channels: ": "Visa länkar-i-videor som förval för kanaler som prenumereras på? ",
"Redirect homepage to feed: ": "Omdirigera hemsida till flöde: ",

View File

@ -86,6 +86,8 @@
"dark": "karanlık",
"light": "aydınlık",
"Thin mode: ": "İnce mod: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Abonelik tercihleri",
"Show annotations by default for subscribed channels: ": "Abone olunan kanallar için ek açıklamaları öntanımlı olarak göster: ",
"Redirect homepage to feed: ": "Ana sayfayı akışa yönlendir: ",

View File

@ -86,6 +86,8 @@
"dark": "темна",
"light": "Світла",
"Thin mode: ": "Полегшене оформлення: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "Налаштування підписок",
"Show annotations by default for subscribed channels: ": "Завжди показувати анотації у відео каналів, на які ви підписані? ",
"Redirect homepage to feed: ": "Показувати відео з каналів, на які підписані, як головну сторінку: ",

View File

@ -86,6 +86,8 @@
"dark": "暗色",
"light": "亮色",
"Thin mode: ": "窄页模式: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "订阅设置",
"Show annotations by default for subscribed channels: ": "默认情况下显示已订阅频道的注释: ",
"Redirect homepage to feed: ": "跳转主页到 feed: ",

View File

@ -86,6 +86,8 @@
"dark": "深色",
"light": "淺色",
"Thin mode: ": "精簡模式: ",
"Miscellaneous preferences": "",
"Automatically redirect to another Instance: ": "",
"Subscription preferences": "訂閱偏好設定",
"Show annotations by default for subscribed channels: ": "預設為已訂閱的頻道顯示註釋: ",
"Redirect homepage to feed: ": "重新導向首頁至 feed ",

View File

@ -44,6 +44,7 @@ struct ConfigPreferences
property quality_dash : String = "auto"
property default_home : String? = "Popular"
property feed_menu : Array(String) = ["Popular", "Trending", "Subscriptions", "Playlists"]
property automatic_instance_redirect : Bool = true
property related_videos : Bool = true
property sort : String = "published"
property speed : Float32 = 1.0_f32

View File

@ -37,8 +37,13 @@ class Invidious::Routes::Misc < Invidious::Routes::BaseRoute
end
def cross_instance_redirect(env)
instance_url = fetch_random_instance
referer = get_referer(env)
if !env.get("preferences").as(Preferences).automatic_instance_redirect
return env.redirect("https://redirect.invidious.io#{referer}")
end
instance_url = fetch_random_instance
env.redirect "https://#{instance_url}#{referer}"
end
end

View File

@ -92,6 +92,10 @@ class Invidious::Routes::PreferencesRoute < Invidious::Routes::BaseRoute
end
end
automatic_instance_redirect = env.params.body["automatic_instance_redirect"]?.try &.as(String)
automatic_instance_redirect ||= "off"
automatic_instance_redirect = automatic_instance_redirect == "on"
locale = env.params.body["locale"]?.try &.as(String)
locale ||= CONFIG.default_user_preferences.locale
@ -141,6 +145,7 @@ class Invidious::Routes::PreferencesRoute < Invidious::Routes::BaseRoute
quality_dash: quality_dash,
default_home: default_home,
feed_menu: feed_menu,
automatic_instance_redirect: automatic_instance_redirect,
related_videos: related_videos,
sort: sort,
speed: speed,

View File

@ -36,6 +36,7 @@ struct Preferences
property annotations : Bool = CONFIG.default_user_preferences.annotations
property annotations_subscribed : Bool = CONFIG.default_user_preferences.annotations_subscribed
property autoplay : Bool = CONFIG.default_user_preferences.autoplay
property automatic_instance_redirect : Bool = CONFIG.default_user_preferences.automatic_instance_redirect
@[JSON::Field(converter: Preferences::StringToArray)]
@[YAML::Field(converter: Preferences::StringToArray)]

View File

@ -176,6 +176,13 @@
<% end %>
</div>
<legend><%= translate(locale, "Miscellaneous preferences") %></legend>
<div class="pure-control-group">
<label for="automatic_instance_redirect"><%= translate(locale, "Automatically redirect to another Instance: ") %></label>
<input name="automatic_instance_redirect" id="automatic_instance_redirect" type="checkbox" <% if preferences.automatic_instance_redirect %>checked<% end %>>
</div>
<% if env.get? "user" %>
<legend><%= translate(locale, "Subscription preferences") %></legend>