From c89f9cd7852ecd94a1c00569f6e80e542a34a517 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Wed, 16 Mar 2022 10:59:34 +0300 Subject: [PATCH] Added librarian #78 --- src/assets/images/lbry-icon.png | Bin 0 -> 18944 bytes src/assets/javascripts/helpers/general.js | 1 + src/assets/javascripts/helpers/imgur.js | 2 +- src/assets/javascripts/helpers/lbry.js | 205 ++++++++++++++++++ src/assets/javascripts/helpers/maps.js | 2 +- src/assets/javascripts/helpers/pixiv.js | 2 +- src/assets/javascripts/helpers/reddit.js | 4 +- src/assets/javascripts/helpers/search.js | 4 +- src/assets/javascripts/helpers/sendTargets.js | 4 +- src/assets/javascripts/helpers/tiktok.js | 2 +- src/assets/javascripts/helpers/twitter.js | 8 +- src/assets/javascripts/helpers/wikipedia.js | 2 +- .../javascripts/helpers/youtube/youtube.js | 14 +- .../javascripts/helpers/youtubeMusic.js | 2 +- src/pages/background/background.js | 60 ++--- src/pages/options/general/general.html | 11 + src/pages/options/imgur/imgur.html | 4 + src/pages/options/instagram/instagram.html | 4 + src/pages/options/lbry/lbry.html | 176 +++++++++++++++ src/pages/options/lbry/lbry.js | 59 +++++ src/pages/options/maps/maps.html | 4 + src/pages/options/medium/medium.html | 4 + src/pages/options/peertube/peertube.html | 4 + src/pages/options/peertube/peertube.js | 6 +- src/pages/options/pixiv/pixiv.html | 4 + src/pages/options/reddit/reddit.html | 4 + src/pages/options/search/search.html | 4 + .../options/sendTargets/sendTargets.html | 4 + src/pages/options/tiktok/tiktok.html | 4 + src/pages/options/translate/translate.html | 4 + src/pages/options/twitter/twitter.html | 4 + src/pages/options/wikipedia/wikipedia.html | 4 + src/pages/options/youtube/youtube.html | 4 + .../options/youtubeMusic/youtubeMusic.html | 4 + src/pages/popup/popup.html | 8 + src/pages/popup/popup.js | 18 +- 36 files changed, 594 insertions(+), 56 deletions(-) create mode 100644 src/assets/images/lbry-icon.png create mode 100644 src/assets/javascripts/helpers/lbry.js create mode 100644 src/pages/options/lbry/lbry.html create mode 100644 src/pages/options/lbry/lbry.js diff --git a/src/assets/images/lbry-icon.png b/src/assets/images/lbry-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..6599574065ccfcc176cdd5e8726ca783f85f7097 GIT binary patch literal 18944 zcmd3O1yfev7cM0t2);DZozf`{(%s$C-Q6K2@` z3^<%~*4cZlr#6vF3X-VE_{cCYFsRZ}Vk$5&u;5Er7$ijSNzb{+9DG7Fk(CsKd4c}R zZY_)l-+ALGrR@R(gK`i3fNitOyaC^Q?J6xV{(AKlE<7Ct-#lzB3=AoZw3vvR=fYvD zhnAZ5@8_3!b#ZLz&h$@dE~2k6B|6ewEbaK_8-2`=Gdy>=J+_zmTy_+87Pr%DB9hTD zld*dVS-!KY@ju*11{wBMVJi}0U$%@*DJCHoUVpTx^eAt=(K&%5;&t5}|M@8#?f;iA zV5I1>22OTq4I%dwo@c0rNXn1%?^qI@4dy~2Vebr}ce*vaAxj6JpYW_Qh@kClo1mhR zpmKkJ9t3_eew&|=n3sT>m+)^hUWD%KPM6LMlP8eNY^c$Z)Xy+99I52k=C^nV4E$DT`KU5j2}`o-R=4Iap@CD%EvZtk!Pw<<(={|C z8%?$iQyR1+8eztZzKf9k$*1y#==2-SZ1iGXntEFOe~!;^*bHjf;_-cAmuO~=?f%Il zsgO>ARfN-g2)PaoTn3D*=kZlL3@>c!w84S33WgAqw#4HZCS_s1F$aE}N{*CtqD&Bn z)!cubPxoy6AKpgymi3-Gz*%+Jh(@UP`rzId2PwetW)2^`FrS_f>qXx&XjIwja&Vt4 zcIMOK5wnPjD?>zAPj)1`o7~O z*JW^rf%LfP@k#x$(Mi?Dx*UyncZz~Pa^9G5;1_F`1WB$V`PG2&a?yLPjtPYs()sV-jjz1+xUgWBz#4(Z5DybLsLdh$V@Jh?bsw zWDd2Y%jZBQ(|boDNyH1=5<%P!>-ZG(=OOYxL#2+yCFSxe zgC_47GXkz^^C68;;j7et`Lv`|BWWB3P9gVt4bF)+()EtKM9Fg0u`z@B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O6N9I#pUXO@geCykjvm1P literal 0 HcmV?d00001 diff --git a/src/assets/javascripts/helpers/general.js b/src/assets/javascripts/helpers/general.js index c542d88..a655fa7 100644 --- a/src/assets/javascripts/helpers/general.js +++ b/src/assets/javascripts/helpers/general.js @@ -118,6 +118,7 @@ let allPopupFrontends = [ "wikipedia", "medium", "peertube", + "lbry", "sendTargets" ]; diff --git a/src/assets/javascripts/helpers/imgur.js b/src/assets/javascripts/helpers/imgur.js index e3e21ec..73f62c5 100644 --- a/src/assets/javascripts/helpers/imgur.js +++ b/src/assets/javascripts/helpers/imgur.js @@ -3,7 +3,7 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' const targets = [ - /^https?:\/\/(i|).?imgur\.com(\/.*)?$/ + /^https?:\/{2}(i|).?imgur\.com(\/.*)?$/ ]; let redirects = { diff --git a/src/assets/javascripts/helpers/lbry.js b/src/assets/javascripts/helpers/lbry.js new file mode 100644 index 0000000..c1eb460 --- /dev/null +++ b/src/assets/javascripts/helpers/lbry.js @@ -0,0 +1,205 @@ +window.browser = window.browser || window.chrome; + +import commonHelper from './common.js' + +let targets = ["odysee.com"]; + +let redirects = { + "librarian": { + "normal": [ + "https://lbry.bcow.xyz", + "https://odysee.076.ne.jp", + "https://lbry.ix.tc", + "https://librarian.pussthecat.org", + "https://lbry.mutahar.rocks", + "https://librarian.esmailelbob.xyz", + ], + "tor": [ + "http://ecc5mi5ncdw6mxhjz6re6g2uevtpbzxjvxgrxia2gyvrlnil3srbnhyd.onion", + "http://vrmbc4brkgkaysmi3fenbzkayobxjh24slmhtocambn3ewe62iuqt3yd.onion", + ] + } +} + +const getRedirects = () => redirects; +const getCustomRedirects = function () { + return { + "librarian": { + "normal": [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects] + }, + }; +}; + +function setRedirects(val) { + redirects.librarian = val; + browser.storage.local.set({ lbryTargetsRedirects: redirects }) + console.log("lbryTargetsRedirects: ", val) + for (const item of librarianNormalRedirectsChecks) + if (!redirects.librarian.normal.includes(item)) { + var index = librarianNormalRedirectsChecks.indexOf(item); + if (index !== -1) librarianNormalRedirectsChecks.splice(index, 1); + } + setLibrarianNormalRedirectsChecks(librarianNormalRedirectsChecks); + + for (const item of librarianTorRedirectsChecks) + if (!redirects.librarian.normal.includes(item)) { + var index = librarianTorRedirectsChecks.indexOf(item); + if (index !== -1) librarianTorRedirectsChecks.splice(index, 1); + } + setLibrarianTorRedirectsChecks(librarianTorRedirectsChecks); +} + +let librarianNormalRedirectsChecks; +const getLibrarianNormalRedirectsChecks = () => librarianNormalRedirectsChecks; +function setLibrarianNormalRedirectsChecks(val) { + librarianNormalRedirectsChecks = val; + browser.storage.local.set({ librarianNormalRedirectsChecks }) + console.log("librarianNormalRedirectsChecks: ", val) +} + +let librarianTorRedirectsChecks; +const getLibrarianTorRedirectsChecks = () => librarianTorRedirectsChecks; +function setLibrarianTorRedirectsChecks(val) { + librarianTorRedirectsChecks = val; + browser.storage.local.set({ librarianTorRedirectsChecks }) + console.log("librarianTorRedirectsChecks: ", val) +} + +let librarianNormalCustomRedirects = []; +const getLibrarianNormalCustomRedirects = () => librarianNormalCustomRedirects; +function setLibrarianNormalCustomRedirects(val) { + librarianNormalCustomRedirects = val; + browser.storage.local.set({ librarianNormalCustomRedirects }) + console.log("librarianNormalCustomRedirects: ", val) +} + +let librarianTorCustomRedirects = []; +const getLibrarianTorCustomRedirects = () => librarianTorCustomRedirects; +function setLibrarianTorCustomRedirects(val) { + librarianTorCustomRedirects = val; + browser.storage.local.set({ librarianTorCustomRedirects }) + console.log("librarianTorCustomRedirects: ", val) +} + +let disable; +const getDisable = () => disable; +function setDisable(val) { + disable = val; + browser.storage.local.set({ disableLbryTargets: disable }) +} + +let protocol; +const getProtocol = () => protocol; +function setProtocol(val) { + protocol = val; + browser.storage.local.set({ lbryTargetsProtocol: val }) + console.log("lbryTargetsProtocol: ", val) +} + +function changeInstance(url) { + let protocolHost = `${url.protocol}//${url.host}`; + + let librarianList = [ + ...redirects.librarian.normal, + ...redirects.librarian.tor, + ...librarianNormalCustomRedirects, + ...librarianTorCustomRedirects, + ]; + + if (!librarianList.includes(protocolHost)) return; + + let instancesList; + if (protocol == 'normal') instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects]; + else if (protocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects]; + + console.log("instancesList", instancesList); + let index = instancesList.indexOf(protocolHost); + if (index > -1) instancesList.splice(index, 1); + + if (instancesList.length === 0) return null; + + let randomInstance = commonHelper.getRandomInstance(instancesList); + return `${randomInstance}${url.pathname}${url.search}`; +} + +function redirect(url, type, initiator) { + if (disable) return null; + if (initiator && ([...redirects.librarian.normal, ...librarianNormalCustomRedirects].includes(initiator.origin) || targets.includes(initiator.host))) return null; + if (!targets.includes(url.host)) return null; + + if (type != "main_frame") return null; + + let instancesList; + if (protocol == 'normal') instancesList = [...librarianNormalRedirectsChecks, ...librarianNormalCustomRedirects]; + if (protocol == 'tor') instancesList = [...librarianTorRedirectsChecks, ...librarianTorCustomRedirects]; + if (instancesList.length === 0) return null; + let randomInstance = commonHelper.getRandomInstance(instancesList); + + return `${randomInstance}${url.pathname}${url.search}`; +} + +async function init() { + return new Promise(resolve => { + fetch('/instances/data.json').then(response => response.text()).then(data => { + let dataJson = JSON.parse(data); + browser.storage.local.get( + [ + "disableLbryTargets", + "lbryTargetsRedirects", + + "librarianNormalRedirectsChecks", + "librarianNormalCustomRedirects", + + "librarianTorRedirectsChecks", + "librarianTorCustomRedirects", + + "lbryTargetsProtocol" + ], + r => { + + disable = r.disableLbryTargets ?? true; + + protocol = r.lbryTargetsProtocol ?? "normal"; + + if (r.lbryTargetsRedirects) redirects = r.lbryTargetsRedirects; + + librarianNormalRedirectsChecks = r.librarianNormalRedirectsChecks ?? [...redirects.librarian.normal]; + librarianNormalCustomRedirects = r.librarianNormalCustomRedirects ?? []; + + librarianTorRedirectsChecks = r.librarianTorRedirectsChecks ?? [...redirects.librarian.tor]; + librarianTorCustomRedirects = r.librarianTorCustomRedirects ?? []; + + resolve(); + } + ) + }); + }); +} + +export default { + + getRedirects, + getCustomRedirects, + setRedirects, + + getDisable, + setDisable, + + getProtocol, + setProtocol, + + getLibrarianNormalRedirectsChecks, + setLibrarianNormalRedirectsChecks, + getLibrarianTorRedirectsChecks, + setLibrarianTorRedirectsChecks, + + getLibrarianTorCustomRedirects, + setLibrarianTorCustomRedirects, + getLibrarianNormalCustomRedirects, + setLibrarianNormalCustomRedirects, + + changeInstance, + + redirect, + init, +}; diff --git a/src/assets/javascripts/helpers/maps.js b/src/assets/javascripts/helpers/maps.js index 73d7330..c340557 100644 --- a/src/assets/javascripts/helpers/maps.js +++ b/src/assets/javascripts/helpers/maps.js @@ -1,7 +1,7 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' -const targets = /^https?:\/\/(((www|maps)\.)?(google\.).*(\/maps)|maps\.(google\.).*)/; +const targets = /^https?:\/{2}(((www|maps)\.)?(google\.).*(\/maps)|maps\.(google\.).*)/; let redirects = { 'osm': { "normal": [ diff --git a/src/assets/javascripts/helpers/pixiv.js b/src/assets/javascripts/helpers/pixiv.js index 236afa8..86ef650 100644 --- a/src/assets/javascripts/helpers/pixiv.js +++ b/src/assets/javascripts/helpers/pixiv.js @@ -3,7 +3,7 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' const targets = [ - /^https?:\/\/(www\.|)pixiv\.net.*/ + /^https?:\/{2}(www\.|)pixiv\.net.*/ ]; let redirects = { diff --git a/src/assets/javascripts/helpers/reddit.js b/src/assets/javascripts/helpers/reddit.js index e434731..500a392 100644 --- a/src/assets/javascripts/helpers/reddit.js +++ b/src/assets/javascripts/helpers/reddit.js @@ -3,8 +3,8 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' const targets = [ - /^https?:\/\/(www\.|old\.|np\.|new\.|amp\.|)reddit\.com/, - /^https?:\/\/(i\.|preview\.)redd\.it/, + /^https?:\/{2}(www\.|old\.|np\.|new\.|amp\.|)reddit\.com/, + /^https?:\/{2}(i\.|preview\.)redd\.it/, ]; let redirects = { // modern UI diff --git a/src/assets/javascripts/helpers/search.js b/src/assets/javascripts/helpers/search.js index f261092..85865f6 100644 --- a/src/assets/javascripts/helpers/search.js +++ b/src/assets/javascripts/helpers/search.js @@ -4,8 +4,8 @@ import commonHelper from './common.js' const targets = [ /^https?:\/{2}(www\.|search\.|)google(\.[a-z]{2,3}){1,2}(\/search(\?.*|$)|\/$)/, - /^https?:\/\/libredirect\.invalid/ - // /^https?:\/\/yandex\.com(\...|)(\/search\/..*|\/$)/, + /^https?:\/{2}libredirect\.invalid/ + // /^https?:\/{2}yandex\.com(\...|)(\/search\/..*|\/$)/, ]; let redirects = { "searx": { diff --git a/src/assets/javascripts/helpers/sendTargets.js b/src/assets/javascripts/helpers/sendTargets.js index 4987b85..d069156 100644 --- a/src/assets/javascripts/helpers/sendTargets.js +++ b/src/assets/javascripts/helpers/sendTargets.js @@ -3,9 +3,9 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' const targets = [ - /^https?:\/\/send.invalid\/$/, + /^https?:\/{2}send.invalid\/$/, /^ https ?: \/\/send\.firefox\.com\/$/, - /^https?:\/\/sendfiles\.online\/$/ + /^https?:\/{2}sendfiles\.online\/$/ ]; let redirects = { diff --git a/src/assets/javascripts/helpers/tiktok.js b/src/assets/javascripts/helpers/tiktok.js index 7f1d15f..671e642 100644 --- a/src/assets/javascripts/helpers/tiktok.js +++ b/src/assets/javascripts/helpers/tiktok.js @@ -3,7 +3,7 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' const targets = [ - /^https?:\/\/(www\.|)tiktok\.com.*/ + /^https?:\/{2}(www\.|)tiktok\.com.*/ ]; let redirects = { diff --git a/src/assets/javascripts/helpers/twitter.js b/src/assets/javascripts/helpers/twitter.js index 7dbdfcf..6a28386 100644 --- a/src/assets/javascripts/helpers/twitter.js +++ b/src/assets/javascripts/helpers/twitter.js @@ -3,10 +3,10 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' const targets = [ - /^https?:\/\/(www\.|mobile\.|)twitter\.com/, - /^https?:\/\/(pbs\.|video\.|)twimg\.com/, - /^https?:\/\/platform\.twitter\.com\/embed/, - /^https?:\/\/t\.co/ + /^https?:\/{2}(www\.|mobile\.|)twitter\.com/, + /^https?:\/{2}(pbs\.|video\.|)twimg\.com/, + /^https?:\/{2}platform\.twitter\.com\/embed/, + /^https?:\/{2}t\.co/ ]; let redirects = { diff --git a/src/assets/javascripts/helpers/wikipedia.js b/src/assets/javascripts/helpers/wikipedia.js index a2e9cab..da713a0 100644 --- a/src/assets/javascripts/helpers/wikipedia.js +++ b/src/assets/javascripts/helpers/wikipedia.js @@ -2,7 +2,7 @@ window.browser = window.browser || window.chrome; import commonHelper from './common.js' -const targets = /^https?:\/\/(.*\.|)wikipedia\.org/ +const targets = /^https?:\/{2}(.*\.|)wikipedia\.org/ let redirects = { "wikiless": { diff --git a/src/assets/javascripts/helpers/youtube/youtube.js b/src/assets/javascripts/helpers/youtube/youtube.js index eb91ab0..8f1ff3f 100644 --- a/src/assets/javascripts/helpers/youtube/youtube.js +++ b/src/assets/javascripts/helpers/youtube/youtube.js @@ -70,16 +70,16 @@ import { } from './options.js'; const targets = [ - /^https?:\/\/(www\.|music\.|m\.|)youtube\.com(\/.*|$)/, + /^https?:\/{2}(www\.|music\.|m\.|)youtube\.com(\/.*|$)/, - /^https?:\/\/img\.youtube\.com\/vi\/.*\/..*/, // https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api - /^https?:\/\/(i|s)\.ytimg\.com\/vi\/.*\/..*/, + /^https?:\/{2}img\.youtube\.com\/vi\/.*\/..*/, // https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api + /^https?:\/{2}(i|s)\.ytimg\.com\/vi\/.*\/..*/, - /^https?:\/\/(www\.|music\.|)youtube\.com\/watch\?v\=..*/, + /^https?:\/{2}(www\.|music\.|)youtube\.com\/watch\?v\=..*/, - /^https?:\/\/youtu\.be\/..*/, + /^https?:\/{2}youtu\.be\/..*/, - /^https?:\/\/(www\.|)(youtube|youtube-nocookie)\.com\/embed\/..*/, + /^https?:\/{2}(www\.|)(youtube|youtube-nocookie)\.com\/embed\/..*/, ]; let redirects = { "invidious": { @@ -383,7 +383,7 @@ function redirect(url, details, initiator) { if (url.pathname.match(/iframe_api/) || url.pathname.match(/www-widgetapi/)) return null; // Don't redirect YouTube Player API. if (frontend == 'yatte' && details.type === "main_frame") - return url.href.replace(/^https?:\/\//, 'yattee://'); + return url.href.replace(/^https?:\/{2}/, 'yattee://'); else if (frontend == 'freetube' && details.type === "main_frame") return `freetube://${url}`; diff --git a/src/assets/javascripts/helpers/youtubeMusic.js b/src/assets/javascripts/helpers/youtubeMusic.js index b3f232c..df713aa 100644 --- a/src/assets/javascripts/helpers/youtubeMusic.js +++ b/src/assets/javascripts/helpers/youtubeMusic.js @@ -5,7 +5,7 @@ import commonHelper from './common.js' window.browser = window.browser || window.chrome; const targets = [ - /^https?:\/\/music\.youtube\.com(\/.*|$)/, + /^https?:\/{2}music\.youtube\.com(\/.*|$)/, ]; let redirects = { "beatbump": { diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 779d0e9..b9a4407 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -14,28 +14,30 @@ import tiktokHelper from "../../assets/javascripts/helpers/tiktok.js"; import pixivHelper from "../../assets/javascripts/helpers/pixiv.js"; import sendTargetsHelper from "../../assets/javascripts/helpers/sendTargets.js"; import peertubeHelper from "../../assets/javascripts/helpers/peertube.js"; +import lbryHelper from "../../assets/javascripts/helpers/lbry.js"; import generalHelper from "../../assets/javascripts/helpers/general.js"; import youtubeMusicHelper from "../../assets/javascripts/helpers/youtubeMusic.js"; window.browser = window.browser || window.chrome; async function wholeInit() { - await youtubeHelper.init() - await youtubeMusicHelper.init() - await twitterHelper.init() - await instagramHelper.init() - await mapsHelper.init() - await searchHelper.init() - await translateHelper.init() - await mediumHelper.init() - await redditHelper.init() - await wikipediaHelper.init() - await imgurHelper.init() - await tiktokHelper.init() - await pixivHelper.init() - await sendTargetsHelper.init() - await peertubeHelper.init() - await generalHelper.init() + await youtubeHelper.init(); + await youtubeMusicHelper.init(); + await twitterHelper.init(); + await instagramHelper.init(); + await mapsHelper.init(); + await searchHelper.init(); + await translateHelper.init(); + await mediumHelper.init(); + await redditHelper.init(); + await wikipediaHelper.init(); + await imgurHelper.init(); + await tiktokHelper.init(); + await pixivHelper.init(); + await sendTargetsHelper.init(); + await peertubeHelper.init(); + await lbryHelper.init(); + await generalHelper.init(); } await wholeInit(); @@ -77,6 +79,8 @@ browser.webRequest.onBeforeRequest.addListener( if (!newUrl) newUrl = peertubeHelper.redirect(url, details.type, initiator); + if (!newUrl) newUrl = lbryHelper.redirect(url, details.type, initiator); + if (!newUrl) newUrl = translateHelper.redirect(url); if (!newUrl) newUrl = searchHelper.redirect(url) @@ -108,19 +112,19 @@ browser.webRequest.onBeforeRequest.addListener( ["blocking"] ); -browser.tabs.onRemoved.addListener((tabId) => { - let index = BYPASSTABs.indexOf(tabId); - if (index > -1) { - BYPASSTABs.splice(index, 1); - console.log("Removed BYPASSTABs", tabId); +browser.tabs.onRemoved.addListener( + tabId => { + let i = BYPASSTABs.indexOf(tabId); + if (i > -1) { + BYPASSTABs.splice(i, 1); + console.log("Removed BYPASSTABs", tabId); + } } -}); +); browser.webRequest.onResponseStarted.addListener( details => { - let autoRedirect = generalHelper.getAutoRedirect(); - - if (!autoRedirect) return null; + if (!generalHelper.getAutoRedirect()) return null; console.log("statusCode", details.statusCode); if (details.type == 'main_frame' && details.statusCode >= 500) { @@ -143,9 +147,11 @@ browser.webRequest.onResponseStarted.addListener( if (!newUrl) newUrl = imgurHelper.changeInstance(url); - if (!newUrl) newUrl = wikipediaHelper.changeInstance(url) + if (!newUrl) newUrl = wikipediaHelper.changeInstance(url); - if (!newUrl) newUrl = peertubeHelper.changeInstance(url) + if (!newUrl) newUrl = peertubeHelper.changeInstance(url); + + if (!newUrl) newUrl = lbryHelper.changeInstance(url); if (newUrl) { browser.tabs.update({ url: '/pages/errors/instance_offline.html' }); diff --git a/src/pages/options/general/general.html b/src/pages/options/general/general.html index 70b26aa..7fa004e 100644 --- a/src/pages/options/general/general.html +++ b/src/pages/options/general/general.html @@ -68,6 +68,10 @@ Peertube +

+ + LBRY/Odysee +
@@ -313,6 +317,13 @@
+
+
+ + LBRY/Odysee +
+ +
diff --git a/src/pages/options/imgur/imgur.html b/src/pages/options/imgur/imgur.html index 6fb9bcf..2519622 100644 --- a/src/pages/options/imgur/imgur.html +++ b/src/pages/options/imgur/imgur.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/instagram/instagram.html b/src/pages/options/instagram/instagram.html index 9b7dfe0..9ff3b3d 100644 --- a/src/pages/options/instagram/instagram.html +++ b/src/pages/options/instagram/instagram.html @@ -70,6 +70,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/lbry/lbry.html b/src/pages/options/lbry/lbry.html new file mode 100644 index 0000000..c1fddf3 --- /dev/null +++ b/src/pages/options/lbry/lbry.html @@ -0,0 +1,176 @@ + + + + + + + + + + LibRedirect Options: TikTok + + + + + +
+
+

Enable

+ +
+ +
+

Protocol

+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/src/pages/options/lbry/lbry.js b/src/pages/options/lbry/lbry.js new file mode 100644 index 0000000..43ff74d --- /dev/null +++ b/src/pages/options/lbry/lbry.js @@ -0,0 +1,59 @@ +import lbryHelper from "../../../assets/javascripts/helpers/lbry.js"; +import commonHelper from "../../../assets/javascripts/helpers/common.js"; + +let disableLbryElement = document.getElementById("disable-lbry"); +disableLbryElement.addEventListener("change", + (event) => lbryHelper.setDisable(!event.target.checked) +); + +let protocolElement = document.getElementById("protocol") +protocolElement.addEventListener("change", + event => { + let protocol = event.target.options[protocolElement.selectedIndex].value + lbryHelper.setProtocol(protocol); + changeProtocolSettings(protocol); + } +); + +function changeProtocolSettings(protocol) { + let normalDiv = document.getElementById("normal"); + let torDiv = document.getElementById("tor"); + if (protocol == 'normal') { + normalDiv.style.display = 'block'; + torDiv.style.display = 'none'; + } + else if (protocol == 'tor') { + normalDiv.style.display = 'none'; + torDiv.style.display = 'block'; + } +} + +lbryHelper.init().then(() => { + disableLbryElement.checked = !lbryHelper.getDisable(); + + let protocol = lbryHelper.getProtocol(); + protocolElement.value = protocol; + changeProtocolSettings(protocol); + + commonHelper.processDefaultCustomInstances( + 'librarian', + 'normal', + lbryHelper, + document, + lbryHelper.getLibrarianNormalRedirectsChecks, + lbryHelper.setLibrarianNormalRedirectsChecks, + lbryHelper.getLibrarianNormalCustomRedirects, + lbryHelper.setLibrarianNormalCustomRedirects + ); + + commonHelper.processDefaultCustomInstances( + 'librarian', + 'tor', + lbryHelper, + document, + lbryHelper.getLibrarianTorRedirectsChecks, + lbryHelper.setLibrarianTorRedirectsChecks, + lbryHelper.getLibrarianTorCustomRedirects, + lbryHelper.setLibrarianTorCustomRedirects + ) +}) \ No newline at end of file diff --git a/src/pages/options/maps/maps.html b/src/pages/options/maps/maps.html index fccb733..0427214 100644 --- a/src/pages/options/maps/maps.html +++ b/src/pages/options/maps/maps.html @@ -70,6 +70,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/medium/medium.html b/src/pages/options/medium/medium.html index 93f7848..6b69bdc 100644 --- a/src/pages/options/medium/medium.html +++ b/src/pages/options/medium/medium.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/peertube/peertube.html b/src/pages/options/peertube/peertube.html index 08b83b1..1ef835f 100644 --- a/src/pages/options/peertube/peertube.html +++ b/src/pages/options/peertube/peertube.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/peertube/peertube.js b/src/pages/options/peertube/peertube.js index a770af8..7aa0f71 100644 --- a/src/pages/options/peertube/peertube.js +++ b/src/pages/options/peertube/peertube.js @@ -1,8 +1,8 @@ import peertubeHelper from "../../../assets/javascripts/helpers/peertube.js"; import commonHelper from "../../../assets/javascripts/helpers/common.js"; -let disableTiktokElement = document.getElementById("disable-peertube"); -disableTiktokElement.addEventListener("change", +let disablePeertubeElement = document.getElementById("disable-peertube"); +disablePeertubeElement.addEventListener("change", (event) => peertubeHelper.setDisable(!event.target.checked) ); @@ -29,7 +29,7 @@ function changeProtocolSettings(protocol) { } peertubeHelper.init().then(() => { - disableTiktokElement.checked = !peertubeHelper.getDisable(); + disablePeertubeElement.checked = !peertubeHelper.getDisable(); let protocol = peertubeHelper.getProtocol(); protocolElement.value = protocol; diff --git a/src/pages/options/pixiv/pixiv.html b/src/pages/options/pixiv/pixiv.html index b34f71a..a66c5d2 100644 --- a/src/pages/options/pixiv/pixiv.html +++ b/src/pages/options/pixiv/pixiv.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/reddit/reddit.html b/src/pages/options/reddit/reddit.html index 737e000..97f5093 100644 --- a/src/pages/options/reddit/reddit.html +++ b/src/pages/options/reddit/reddit.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/search/search.html b/src/pages/options/search/search.html index 3f3659c..6683c29 100644 --- a/src/pages/options/search/search.html +++ b/src/pages/options/search/search.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/sendTargets/sendTargets.html b/src/pages/options/sendTargets/sendTargets.html index ab84a56..983db90 100644 --- a/src/pages/options/sendTargets/sendTargets.html +++ b/src/pages/options/sendTargets/sendTargets.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/tiktok/tiktok.html b/src/pages/options/tiktok/tiktok.html index a6b6c6b..4f82cec 100644 --- a/src/pages/options/tiktok/tiktok.html +++ b/src/pages/options/tiktok/tiktok.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/translate/translate.html b/src/pages/options/translate/translate.html index f451c83..34b2ebe 100644 --- a/src/pages/options/translate/translate.html +++ b/src/pages/options/translate/translate.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/twitter/twitter.html b/src/pages/options/twitter/twitter.html index 668ba3c..9e4a5d4 100644 --- a/src/pages/options/twitter/twitter.html +++ b/src/pages/options/twitter/twitter.html @@ -70,6 +70,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/wikipedia/wikipedia.html b/src/pages/options/wikipedia/wikipedia.html index 379d33c..1c12ea1 100644 --- a/src/pages/options/wikipedia/wikipedia.html +++ b/src/pages/options/wikipedia/wikipedia.html @@ -69,6 +69,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/youtube/youtube.html b/src/pages/options/youtube/youtube.html index 7b55550..6146171 100644 --- a/src/pages/options/youtube/youtube.html +++ b/src/pages/options/youtube/youtube.html @@ -70,6 +70,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/options/youtubeMusic/youtubeMusic.html b/src/pages/options/youtubeMusic/youtubeMusic.html index cc446de..ca90dcc 100644 --- a/src/pages/options/youtubeMusic/youtubeMusic.html +++ b/src/pages/options/youtubeMusic/youtubeMusic.html @@ -70,6 +70,10 @@ Peertube
+
+ + LBRY/Odysee +
diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html index 981b604..419c959 100644 --- a/src/pages/popup/popup.html +++ b/src/pages/popup/popup.html @@ -106,6 +106,14 @@
+ +