about summary refs log tree commit diff stats
path: root/background.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--background.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/background.js b/background.js
index ed94294b..45e01f89 100644
--- a/background.js
+++ b/background.js
@@ -119,6 +119,7 @@ let invidiousVolume;
 let invidiousPlayerStyle;
 let invidiousSubtitles;
 let invidiousAutoplay;
+let useFreeTube;
 let exceptions;
 
 window.browser = window.browser || window.chrome;
@@ -141,6 +142,7 @@ browser.storage.sync.get(
     "invidiousPlayerStyle",
     "invidiousSubtitles",
     "invidiousAutoplay",
+    "useFreeTube",
     "exceptions",
   ],
   (result) => {
@@ -165,6 +167,7 @@ browser.storage.sync.get(
     invidiousPlayerStyle = result.invidiousPlayerStyle;
     invidiousSubtitles = result.invidiousSubtitles || "";
     invidiousAutoplay = result.invidiousAutoplay;
+    useFreeTube = result.useFreeTube;
   }
 );
 
@@ -217,6 +220,9 @@ browser.storage.onChanged.addListener((changes) => {
   if ("invidiousAutoplay" in changes) {
     invidiousAutoplay = changes.invidiousAutoplay.newValue;
   }
+  if ("useFreeTube" in changes) {
+    useFreeTube = changes.useFreeTube.newValue;
+  }
   if ("exceptions" in changes) {
     exceptions = changes.exceptions.newValue.map((e) => {
       return new RegExp(e);
@@ -287,6 +293,9 @@ function redirectYouTube(url, initiator, type) {
   if (onlyEmbeddedVideo && type !== "sub_frame") {
     return null;
   }
+  if (useFreeTube) {
+    return `freetube://${url}`;
+  }
   // Apply settings
   if (alwaysProxy) {
     url.searchParams.append("local", true);