diff options
author | SimonBrazell <simon@brazell.com.au> | 2020-11-04 21:55:42 +1100 |
---|---|---|
committer | SimonBrazell <simon@brazell.com.au> | 2020-11-04 21:55:42 +1100 |
commit | 748f3d0f3a85a5f0acb26ae7e792935da6d9ad93 (patch) | |
tree | 018c2ebfb817613626d8b6b48ebdf7f73e1f6384 /background.js | |
parent | Clean up invidious random instance list (diff) | |
download | libredirect-748f3d0f3a85a5f0acb26ae7e792935da6d9ad93.zip |
Closes #113 - Added support for FreeTube
Diffstat (limited to '')
-rw-r--r-- | background.js | 9 |
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); |