From b63bebb519c448df6576c7bd124f2ce7681cc203 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sat, 15 May 2021 20:08:33 -0700 Subject: [PATCH] Allow automatic instance redirect to be turned off Instead the "switch invidious instance" link would bring users to redirect.invidious.io --- locales/ar.json | 4 +++- locales/bn_BD.json | 2 ++ locales/cs.json | 2 ++ locales/da.json | 2 ++ locales/de.json | 2 ++ locales/el.json | 2 ++ locales/en-US.json | 2 ++ locales/eo.json | 2 ++ locales/es.json | 2 ++ locales/eu.json | 2 ++ locales/fa.json | 2 ++ locales/fi.json | 2 ++ locales/fr.json | 2 ++ locales/he.json | 2 ++ locales/hr.json | 2 ++ locales/hu-HU.json | 2 ++ locales/id.json | 2 ++ locales/is.json | 2 ++ locales/it.json | 2 ++ locales/ja.json | 2 ++ locales/nb-NO.json | 2 ++ locales/nl.json | 4 +++- locales/pl.json | 2 ++ locales/pt-BR.json | 2 ++ locales/pt-PT.json | 2 ++ locales/ro.json | 4 +++- locales/ru.json | 4 +++- locales/si.json | 2 ++ locales/sk.json | 2 ++ locales/sr.json | 2 ++ locales/sr_Cyrl.json | 2 ++ locales/sv-SE.json | 2 ++ locales/tr.json | 2 ++ locales/uk.json | 4 +++- locales/zh-CN.json | 2 ++ locales/zh-TW.json | 2 ++ src/invidious/helpers/helpers.cr | 1 + src/invidious/routes/misc.cr | 7 ++++++- src/invidious/routes/preferences.cr | 5 +++++ src/invidious/users.cr | 1 + src/invidious/views/preferences.ecr | 7 +++++++ 41 files changed, 97 insertions(+), 6 deletions(-) diff --git a/locales/ar.json b/locales/ar.json index a14e41010..b12c4cb84 100644 --- a/locales/ar.json +++ b/locales/ar.json @@ -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: ": "إعادة التوجية من الصفحة الرئيسية لصفحة المشتركين (لرؤية اخر فيديوهات المشتركين): ", @@ -418,4 +420,4 @@ "hdr": "وضع التباين العالي", "filter": "معامل الفرز", "Current version: ": "الإصدار الحالي: " -} +} \ No newline at end of file diff --git a/locales/bn_BD.json b/locales/bn_BD.json index 9b1df424a..9de526d54 100644 --- a/locales/bn_BD.json +++ b/locales/bn_BD.json @@ -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: ": "", diff --git a/locales/cs.json b/locales/cs.json index b85bcd102..3d59466a2 100644 --- a/locales/cs.json +++ b/locales/cs.json @@ -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: ", diff --git a/locales/da.json b/locales/da.json index 525c9d0f4..03b176f44 100644 --- a/locales/da.json +++ b/locales/da.json @@ -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: ", diff --git a/locales/de.json b/locales/de.json index 2192fd976..606fbeb5e 100644 --- a/locales/de.json +++ b/locales/de.json @@ -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: ", diff --git a/locales/el.json b/locales/el.json index 9192edf3e..94611e82f 100644 --- a/locales/el.json +++ b/locales/el.json @@ -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: ": "Ανακατεύθυνση αρχικής στη ροή συνδρομών: ", diff --git a/locales/en-US.json b/locales/en-US.json index 6d6a88ea3..29eae79ec 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -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: ", diff --git a/locales/eo.json b/locales/eo.json index 5528845b4..698110066 100644 --- a/locales/eo.json +++ b/locales/eo.json @@ -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: ", diff --git a/locales/es.json b/locales/es.json index fa83d6dc2..25329d401 100644 --- a/locales/es.json +++ b/locales/es.json @@ -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: ", diff --git a/locales/eu.json b/locales/eu.json index ec90b82e6..426d721f1 100644 --- a/locales/eu.json +++ b/locales/eu.json @@ -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: ": "", diff --git a/locales/fa.json b/locales/fa.json index 5bc99b60d..6b40af620 100644 --- a/locales/fa.json +++ b/locales/fa.json @@ -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: ": "تغییر مسیر صفحه خانه به خوراک: ", diff --git a/locales/fi.json b/locales/fi.json index f4aeae2b8..24a4ec367 100644 --- a/locales/fi.json +++ b/locales/fi.json @@ -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: ", diff --git a/locales/fr.json b/locales/fr.json index 21dd2798d..75cd2be01 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -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 : ", diff --git a/locales/he.json b/locales/he.json index 1645bd939..368a7e081 100644 --- a/locales/he.json +++ b/locales/he.json @@ -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: ": "", diff --git a/locales/hr.json b/locales/hr.json index 6c3136668..5cadab8f0 100644 --- a/locales/hr.json +++ b/locales/hr.json @@ -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: ", diff --git a/locales/hu-HU.json b/locales/hu-HU.json index a25597d5c..5c67b4e7b 100644 --- a/locales/hu-HU.json +++ b/locales/hu-HU.json @@ -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: ", diff --git a/locales/id.json b/locales/id.json index 5cf3e65c7..0ed116b8c 100644 --- a/locales/id.json +++ b/locales/id.json @@ -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: ", diff --git a/locales/is.json b/locales/is.json index d80e10e29..d9ec4105b 100644 --- a/locales/is.json +++ b/locales/is.json @@ -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: ", diff --git a/locales/it.json b/locales/it.json index e1446f8b3..4105e83f9 100644 --- a/locales/it.json +++ b/locales/it.json @@ -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: ", diff --git a/locales/ja.json b/locales/ja.json index 80cbdd81b..3c6efb775 100644 --- a/locales/ja.json +++ b/locales/ja.json @@ -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: ": "ホームからフィードにリダイレクト: ", diff --git a/locales/nb-NO.json b/locales/nb-NO.json index 55e0da682..4b5eabd0f 100644 --- a/locales/nb-NO.json +++ b/locales/nb-NO.json @@ -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: ", diff --git a/locales/nl.json b/locales/nl.json index c73952ee1..16cdb4277 100644 --- a/locales/nl.json +++ b/locales/nl.json @@ -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: ", @@ -418,4 +420,4 @@ "hdr": "HDR", "filter": "verfijnen", "Current version: ": "Huidige versie: " -} +} \ No newline at end of file diff --git a/locales/pl.json b/locales/pl.json index ac170c0a0..f8df837c3 100644 --- a/locales/pl.json +++ b/locales/pl.json @@ -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: ", diff --git a/locales/pt-BR.json b/locales/pt-BR.json index 8a112a8a3..644aa34dc 100644 --- a/locales/pt-BR.json +++ b/locales/pt-BR.json @@ -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: ", diff --git a/locales/pt-PT.json b/locales/pt-PT.json index 4555f8700..c02ca58e6 100644 --- a/locales/pt-PT.json +++ b/locales/pt-PT.json @@ -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: ", diff --git a/locales/ro.json b/locales/ro.json index e021a622e..5c984ab52 100644 --- a/locales/ro.json +++ b/locales/ro.json @@ -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: ", @@ -418,4 +420,4 @@ "hdr": "", "filter": "", "Current version: ": "Versiunea actuală: " -} +} \ No newline at end of file diff --git a/locales/ru.json b/locales/ru.json index db1be8ea7..cd29f06ac 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -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: ": "Отображать видео с каналов, на которые вы подписаны, как главную страницу: ", @@ -418,4 +420,4 @@ "hdr": "", "filter": "", "Current version: ": "Текущая версия: " -} +} \ No newline at end of file diff --git a/locales/si.json b/locales/si.json index 3ff9b4ed8..23cacc1e8 100644 --- a/locales/si.json +++ b/locales/si.json @@ -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: ": "", diff --git a/locales/sk.json b/locales/sk.json index eb696e5bc..ed82fae64 100644 --- a/locales/sk.json +++ b/locales/sk.json @@ -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: ", diff --git a/locales/sr.json b/locales/sr.json index 76f9fab6b..0c64e176a 100644 --- a/locales/sr.json +++ b/locales/sr.json @@ -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: ": "", diff --git a/locales/sr_Cyrl.json b/locales/sr_Cyrl.json index 2f5a5f60c..a76684b4d 100644 --- a/locales/sr_Cyrl.json +++ b/locales/sr_Cyrl.json @@ -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: ": "Прикажи праћења као почетну страницу: ", diff --git a/locales/sv-SE.json b/locales/sv-SE.json index 8ecc5424d..fe12f8d13 100644 --- a/locales/sv-SE.json +++ b/locales/sv-SE.json @@ -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: ", diff --git a/locales/tr.json b/locales/tr.json index 2314b4abd..ca36023a2 100644 --- a/locales/tr.json +++ b/locales/tr.json @@ -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: ", diff --git a/locales/uk.json b/locales/uk.json index ca44e3bb0..9e9239d1a 100644 --- a/locales/uk.json +++ b/locales/uk.json @@ -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: ": "Показувати відео з каналів, на які підписані, як головну сторінку: ", @@ -418,4 +420,4 @@ "hdr": "", "filter": "", "Current version: ": "Поточна версія: " -} +} \ No newline at end of file diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 28935e4ae..7f58d67c9 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -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: ", diff --git a/locales/zh-TW.json b/locales/zh-TW.json index bdae76781..61a9f1184 100644 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -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: ", diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index 1f92c4ce3..b020d4fe6 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -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 diff --git a/src/invidious/routes/misc.cr b/src/invidious/routes/misc.cr index 13fc65bb8..336f7e339 100644 --- a/src/invidious/routes/misc.cr +++ b/src/invidious/routes/misc.cr @@ -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 diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index f98c7a5e6..20f68aeac 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -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, diff --git a/src/invidious/users.cr b/src/invidious/users.cr index d774ee124..98ef8792e 100644 --- a/src/invidious/users.cr +++ b/src/invidious/users.cr @@ -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)] diff --git a/src/invidious/views/preferences.ecr b/src/invidious/views/preferences.ecr index 1e1e8cae0..bc09ec794 100644 --- a/src/invidious/views/preferences.ecr +++ b/src/invidious/views/preferences.ecr @@ -176,6 +176,13 @@ <% end %> + <%= translate(locale, "Miscellaneous preferences") %> + +
+ + checked<% end %>> +
+ <% if env.get? "user" %> <%= translate(locale, "Subscription preferences") %>