diff --git a/src/_locales/de/messages.json b/src/_locales/de/messages.json index ec39f4b..ba99bcc 100644 --- a/src/_locales/de/messages.json +++ b/src/_locales/de/messages.json @@ -43,7 +43,7 @@ "message": "Videos immer durch Invidious-Proxy leiten", "description": "Label for 'Always proxy videos through Invidious' option (options)." }, - "invidiousOnlyEmbeddedVideo": { + "OnlyEmbeddedVideo": { "message": "Nur eingebettete Videos zu Invidious weiterleiten", "description": "Label for 'Only redirect embedded video to Invidious' option (options)." }, diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 865c084..c0426fc 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -83,7 +83,7 @@ "message": "Always proxy videos through Invidious", "description": "Label for 'Always proxy videos through Invidious' option (options)." }, - "invidiousOnlyEmbeddedVideo": { + "OnlyEmbeddedVideo": { "message": "Only redirect embedded video to Invidious", "description": "Label for 'Only redirect embedded video to Invidious' option (options)." }, diff --git a/src/_locales/es/messages.json b/src/_locales/es/messages.json index 472f783..b7a3b4f 100644 --- a/src/_locales/es/messages.json +++ b/src/_locales/es/messages.json @@ -75,7 +75,7 @@ "message": "Siempre usar el proxy de Invidious para videos", "description": "Etiqueta para la opción de 'Siempre usar el proxy de Invidious para videos' (opciones)." }, - "invidiousOnlyEmbeddedVideo": { + "OnlyEmbeddedVideo": { "message": "Solo redirigir los videos incrustados a Invidious", "description": "Etiqueta para la opción de 'Solo redirigir los videos incrustados a Invidious' (opciones)." }, diff --git a/src/_locales/fr/messages.json b/src/_locales/fr/messages.json index 5cb4e92..0ba3c6c 100644 --- a/src/_locales/fr/messages.json +++ b/src/_locales/fr/messages.json @@ -43,7 +43,7 @@ "message": "Toujours transiter par proxy les vidéos via Invidious", "description": "Libellé pour l'option 'Toujours transiter par proxy les vidéos via Invidious' (options)." }, - "invidiousOnlyEmbeddedVideo": { + "OnlyEmbeddedVideo": { "message": "Rediriger uniquement les vidéos intégrées vers Invidious", "description": "Libellé pour l'option 'Rediriger uniquement les vidéos intégrées vers Invidious' (options)." }, diff --git a/src/_locales/it/messages.json b/src/_locales/it/messages.json index 25f2851..641f784 100644 --- a/src/_locales/it/messages.json +++ b/src/_locales/it/messages.json @@ -67,7 +67,7 @@ "message": "Usa sempre il proxy per i video su Invidious", "description": "Label for 'Always proxy videos through Invidious' option (options)." }, - "invidiousOnlyEmbeddedVideo": { + "OnlyEmbeddedVideo": { "message": "Reindirizza solo i video incorporati verso Invidious", "description": "Label for 'Only redirect embedded video to Invidious' option (options)." }, diff --git a/src/_locales/pl/messages.json b/src/_locales/pl/messages.json index 3377ae1..b628840 100644 --- a/src/_locales/pl/messages.json +++ b/src/_locales/pl/messages.json @@ -43,7 +43,7 @@ "message": "Zawsze buforuj i wyświetlaj odnośniki wideo z YouTube poprzez Invidious", "description": "Etykieta dla opcji 'Zawsze buforuj i wyświetlaj odnośniki wideo poprzez Invidious'." }, - "invidiousOnlyEmbeddedVideo": { + "OnlyEmbeddedVideo": { "message": "Jedynie przekieruj odnośniki wideo do instancji Invidious", "description": "Etykieta dla opcji 'Jedynie przekieruj odnośniki wideo do instancji Invidious'." }, diff --git a/src/_locales/ru/messages.json b/src/_locales/ru/messages.json index 91d130c..5564586 100644 --- a/src/_locales/ru/messages.json +++ b/src/_locales/ru/messages.json @@ -71,7 +71,7 @@ "message": "Всегда проксировать видео через Invidious", "description": "Название настройки для 'Всегда проксировать видео через Invidious' (в настройках)." }, - "invidiousOnlyEmbeddedVideo": { + "OnlyEmbeddedVideo": { "message": "Перенаправлять только встроенные видео на Invidious", "description": "Название настройки для 'Перенаправлять только встроенные видео на Invidious' (в настройках)." }, diff --git a/src/_locales/tr/messages.json b/src/_locales/tr/messages.json index 348ffae..8440e7d 100644 --- a/src/_locales/tr/messages.json +++ b/src/_locales/tr/messages.json @@ -59,7 +59,7 @@ "message": "Videoları her zaman Invidious üzerinden geçir", "description": "'Videoları her zaman Invidious üzerinden geçir' seçeneği için etiket (seçenekler)." }, - "invidiousOnlyEmbeddedVideo": { + "OnlyEmbeddedVideo": { "message": "Sadece siteye gömülü videoları Invidious'a yönlendir", "description": "'Sadece siteye gömülü videoları Invidious'a yönlendir' seçeneği için etiket (seçenekler)." }, diff --git a/src/_locales/zh_CN/messages.json b/src/_locales/zh_CN/messages.json index 6fe05b6..fc780ea 100644 --- a/src/_locales/zh_CN/messages.json +++ b/src/_locales/zh_CN/messages.json @@ -43,7 +43,7 @@ "message": "使用 Invidious 时始终使用视频代理", "description": "Label for 'Always proxy videos through Invidious' option (options)." }, - "invidiousOnlyEmbeddedVideo": { + "OnlyEmbeddedVideo": { "message": "只重定向嵌入视频至 Invidious", "description": "Label for 'Only redirect embedded video to Invidious' option (options)." }, diff --git a/src/assets/javascripts/helpers/youtube/invidious-cookies.js b/src/assets/javascripts/helpers/youtube/invidious-cookies.js index 6b77a27..1ccdf1f 100644 --- a/src/assets/javascripts/helpers/youtube/invidious-cookies.js +++ b/src/assets/javascripts/helpers/youtube/invidious-cookies.js @@ -17,7 +17,7 @@ browser.storage.sync.get( "invidiousAlwaysProxy", "invidiousVideoQuality", "invidiousDarkMode", - "invidiousOnlyEmbeddedVideo", + "OnlyEmbeddedVideo", "invidiousVolume", "invidiousPlayerStyle", "invidiousSubtitles", diff --git a/src/assets/javascripts/helpers/youtube/youtube.js b/src/assets/javascripts/helpers/youtube/youtube.js index 5731599..7c23f25 100644 --- a/src/assets/javascripts/helpers/youtube/youtube.js +++ b/src/assets/javascripts/helpers/youtube/youtube.js @@ -125,13 +125,13 @@ function setInvidiousAlwaysProxy(val) { } const getInvidiousAlwaysProxy = () => invidiousAlwaysProxy; -let invidiousOnlyEmbeddedVideo; -function setInvidiousOnlyEmbeddedVideo(val) { - invidiousOnlyEmbeddedVideo = val; - browser.storage.sync.set({ invidiousOnlyEmbeddedVideo }) - console.log("invidiousOnlyEmbeddedVideo: ", invidiousOnlyEmbeddedVideo) +let OnlyEmbeddedVideo; +function setOnlyEmbeddedVideo(val) { + OnlyEmbeddedVideo = val; + browser.storage.sync.set({ OnlyEmbeddedVideo }) + console.log("OnlyEmbeddedVideo: ", OnlyEmbeddedVideo) } -const getInvidiousOnlyEmbeddedVideo = () => invidiousOnlyEmbeddedVideo; +const getOnlyEmbeddedVideo = () => OnlyEmbeddedVideo; let invidiousVideoQuality; function setInvidiousVideoQuality(val) { @@ -265,7 +265,7 @@ async function init() { "invidiousTheme", "persistInvidiousPrefs", "disableYoutube", - "invidiousOnlyEmbeddedVideo", + "OnlyEmbeddedVideo", "invidiousVolume", "invidiousPlayerStyle", "invidiousSubtitles", @@ -285,7 +285,7 @@ async function init() { disableYoutube = result.disableYoutube ?? false; invidiousAlwaysProxy = result.invidiousAlwaysProxy ?? 'DEFAULT'; - invidiousOnlyEmbeddedVideo = result.invidiousOnlyEmbeddedVideo ?? false; + OnlyEmbeddedVideo = result.OnlyEmbeddedVideo ?? 'both'; invidiousVideoQuality = result.invidiousVideoQuality ?? 'DEFAULT'; invidiousTheme = result.invidiousTheme ?? 'DEFAULT'; invidiousVolume = result.invidiousVolume ?? '--'; @@ -319,6 +319,8 @@ function invidiousInitCookies(tabId) { function redirect(url, type) { + console.log("type", type); + if (frontend == 'freeTube' && type === "main_frame") return `freetube://${url}`; @@ -328,7 +330,8 @@ function redirect(url, type) { if (instancesList.length === 0) return null; let randomInstance = commonHelper.getRandomInstance(instancesList); - if (invidiousOnlyEmbeddedVideo && type !== "sub_frame") return null; + if (OnlyEmbeddedVideo == 'onlyEmbedded' && type !== "sub_frame") return null + if (OnlyEmbeddedVideo == 'onlyNotEmbedded' && type !== "main_frame") return null; if (invidiousAlwaysProxy != "DEFAULT") url.searchParams.append("local", invidiousAlwaysProxy); if (invidiousVideoQuality != "DEFAULT") url.searchParams.append("quality", invidiousVideoQuality); @@ -346,7 +349,8 @@ function redirect(url, type) { if (instancesList.length === 0) return null; let randomInstance = commonHelper.getRandomInstance(instancesList); - if (invidiousOnlyEmbeddedVideo && type !== "sub_frame") return null; + if (OnlyEmbeddedVideo == 'onlyEmbedded' && type !== "sub_frame") return null + if (OnlyEmbeddedVideo == 'onlyNotEmbedded' && type !== "main_frame") return null; if (invidiousTheme != "DEFAULT") url.searchParams.append("theme", invidiousTheme); if (invidiousVolume != "--") url.searchParams.append("volume", invidiousVolume / 100); @@ -377,8 +381,8 @@ export default { setInvidiousAlwaysProxy, getInvidiousAlwaysProxy, - setInvidiousOnlyEmbeddedVideo, - getInvidiousOnlyEmbeddedVideo, + setOnlyEmbeddedVideo, + getOnlyEmbeddedVideo, setInvidiousVideoQuality, getInvidiousVideoQuality, diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 8add9c3..bebb64f 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -47,7 +47,7 @@ browser.webRequest.onBeforeRequest.addListener( if (exceptionsHelper.isException(url)) newUrl = null; - else if (youtubeHelper.isYoutube(url, initiator)) newUrl = youtubeHelper.redirect(url, initiator, details.type) + else if (youtubeHelper.isYoutube(url, initiator)) newUrl = youtubeHelper.redirect(url, details.type) else if (twitterHelper.isTwitter(url)) newUrl = twitterHelper.redirect(url, initiator); diff --git a/src/pages/options/youtube/youtube.html b/src/pages/options/youtube/youtube.html index b21e515..34d6ab5 100644 --- a/src/pages/options/youtube/youtube.html +++ b/src/pages/options/youtube/youtube.html @@ -128,7 +128,11 @@