From e618299a04f93c9769e3974c2b9f57171e8a5ea4 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Tue, 2 Aug 2022 19:50:40 +0300 Subject: Unify won't save in storage anymore. Fixed Piped Unify --- src/assets/javascripts/tiktok.js | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'src/assets/javascripts/tiktok.js') diff --git a/src/assets/javascripts/tiktok.js b/src/assets/javascripts/tiktok.js index ba4a9ff1..9d2660d4 100644 --- a/src/assets/javascripts/tiktok.js +++ b/src/assets/javascripts/tiktok.js @@ -62,26 +62,6 @@ function initProxiTokCookies(test, from) { }) } -function pasteProxiTokCookies() { - return new Promise(async resolve => { - await init() - if (disableTiktok || protocol === undefined) { - resolve() - return - } - let checkedInstances = [] - if (protocol == "loki") checkedInstances = [...proxiTokI2pCustomRedirects] - else if (protocol == "i2p") checkedInstances = [...proxiTokLokiCustomRedirects] - else if (protocol == "tor") checkedInstances = [...proxiTokTorRedirectsChecks, ...proxiTokTorCustomRedirects] - if ((checkedInstances.length === 0 && protocolFallback) || protocol == "normal") { - checkedInstances = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects] - } - utils.getCookiesFromStorage("proxitok", checkedInstances, "theme") - utils.getCookiesFromStorage("proxitok", checkedInstances, "api-legacy") - resolve() - }) -} - let disableTiktok, protocol, protocolFallback, @@ -248,13 +228,9 @@ function initDefaults() { export default { setRedirects, - redirect, reverse, switchInstance, - initProxiTokCookies, - pasteProxiTokCookies, - initDefaults, } -- cgit 1.4.1 From 341afc4055f292535fb9097ffcaff25b38c3c953 Mon Sep 17 00:00:00 2001 From: BobIsMyManager Date: Tue, 2 Aug 2022 21:55:17 +0100 Subject: Finish offline detection --- src/assets/javascripts/imdb.js | 13 ++++- src/assets/javascripts/imgur.js | 57 ++++++------------- src/assets/javascripts/instagram.js | 18 +++--- src/assets/javascripts/lbry.js | 13 ++++- src/assets/javascripts/maps.js | 13 ++++- src/assets/javascripts/medium.js | 18 +++--- src/assets/javascripts/peertube.js | 18 +++--- src/assets/javascripts/quora.js | 13 ++++- src/assets/javascripts/reddit.js | 30 +++++----- src/assets/javascripts/reuters.js | 13 ++++- src/assets/javascripts/search.js | 79 +++++++-------------------- src/assets/javascripts/sendTargets.js | 18 +++--- src/assets/javascripts/tiktok.js | 14 ++++- src/assets/javascripts/translate/translate.js | 35 +++++++----- src/assets/javascripts/twitter.js | 21 ++++--- src/assets/javascripts/utils.js | 23 +++----- src/assets/javascripts/wikipedia.js | 18 +++--- src/assets/javascripts/youtube/youtube.js | 21 +++---- src/assets/javascripts/youtubeMusic.js | 30 +++++----- src/pages/background/background.js | 40 +++++++------- src/pages/options/index.html | 2 +- src/pages/options/widgets/general.js | 2 + 22 files changed, 244 insertions(+), 265 deletions(-) (limited to 'src/assets/javascripts/tiktok.js') diff --git a/src/assets/javascripts/imdb.js b/src/assets/javascripts/imdb.js index 9981f1b9..1f6c7a5f 100644 --- a/src/assets/javascripts/imdb.js +++ b/src/assets/javascripts/imdb.js @@ -17,10 +17,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.libremdb = val libremdbNormalRedirectsChecks = [...redirects.libremdb.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = libremdbNormalRedirectsChecks.indexOf(instance) if (a > -1) libremdbNormalRedirectsChecks.splice(a, 1) } @@ -172,12 +172,18 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + libremdbNormalRedirectsChecks = [...redirects.libremdb.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = libremdbNormalRedirectsChecks.indexOf(instance) + if (a > -1) libremdbNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableImdb: true, imdbRedirects: redirects, - libremdbNormalRedirectsChecks: [...redirects.libremdb.normal], + libremdbNormalRedirectsChecks, libremdbNormalCustomRedirects: [], libremdbTorRedirectsChecks: [...redirects.libremdb.tor], @@ -192,6 +198,7 @@ function initDefaults() { () => resolve() ) }) + }) }) } diff --git a/src/assets/javascripts/imgur.js b/src/assets/javascripts/imgur.js index 9ccd24af..25f61f06 100644 --- a/src/assets/javascripts/imgur.js +++ b/src/assets/javascripts/imgur.js @@ -16,39 +16,18 @@ for (let i = 0; i < frontends.length; i++) { } } -function setRedirects() { - return new Promise(resolve => { - fetch("/instances/data.json") - .then(response => response.text()) - .then(async data => { - let dataJson = JSON.parse(data) - redirects.rimgo = dataJson.rimgo - - rimgoNormalRedirectsChecks = [...redirects.rimgo.normal] - rimgoTorRedirectsChecks = [...redirects.rimgo.tor] - rimgoI2pRedirectsChecks = [...redirects.rimgo.i2p] - - for (const instance of r.cloudflareBlackList) { - const a = rimgoNormalRedirectsChecks.indexOf(instance) - if (a > -1) rimgoNormalRedirectsChecks.splice(a, 1) - - const b = rimgoTorRedirectsChecks.indexOf(instance) - if (b > -1) rimgoTorRedirectsChecks.splice(b, 1) - - const c = rimgoI2pRedirectsChecks.indexOf(instance) - if (c > -1) rimgoI2pRedirectsChecks.splice(c, 1) - } - - browser.storage.local.set( - { - imgurRedirects: redirects, - rimgoNormalRedirectsChecks, - rimgoTorRedirectsChecks, - rimgoI2pRedirectsChecks, - }, - () => resolve() - ) - }) +function setRedirects(val) { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { + redirects.rimgo = val + rimgoNormalRedirectsChecks = [...redirects.rimgo.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = rimgoNormalRedirectsChecks.indexOf(instance) + if (a > -1) rimgoNormalRedirectsChecks.splice(a, 1) + } + browser.storage.local.set({ + imgurRedirects: redirects, + rimgoNormalRedirectsChecks, + }) }) } @@ -195,12 +174,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { - rimgoNormalRedirectsChecks = [...redirects.rimgo.normal] - for (const instance of r.cloudflareBlackList) { - const i = rimgoNormalRedirectsChecks.indexOf(instance) - if (i > -1) rimgoNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + rimgoNormalRedirectsChecks = [...redirects.rimgo.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = rimgoNormalRedirectsChecks.indexOf(instance) + if (a > -1) rimgoNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableImgur: false, diff --git a/src/assets/javascripts/instagram.js b/src/assets/javascripts/instagram.js index 00042074..a65dac80 100644 --- a/src/assets/javascripts/instagram.js +++ b/src/assets/javascripts/instagram.js @@ -16,10 +16,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", async r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { redirects.bibliogram = val bibliogramNormalRedirectsChecks = [...redirects.bibliogram.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = bibliogramNormalRedirectsChecks.indexOf(instance) if (a > -1) bibliogramNormalRedirectsChecks.splice(a, 1) } @@ -203,17 +203,17 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", r => { - bibliogramNormalRedirectsChecks = [...redirects.bibliogram.normal] - for (const instance of r.cloudflareBlackList) { - const i = bibliogramNormalRedirectsChecks.indexOf(instance) - if (i > -1) bibliogramNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + bibliogramNormalRedirectsChecks = [...redirects.bibliogram.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = bibliogramNormalRedirectsChecks.indexOf(instance) + if (a > -1) bibliogramNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set({ disableInstagram: false, instagramRedirects: redirects, - bibliogramNormalRedirectsChecks: bibliogramNormalRedirectsChecks, + bibliogramNormalRedirectsChecks, bibliogramNormalCustomRedirects: [], bibliogramTorRedirectsChecks: [...redirects.bibliogram.tor], diff --git a/src/assets/javascripts/lbry.js b/src/assets/javascripts/lbry.js index 0c4d34cc..b1e6f477 100644 --- a/src/assets/javascripts/lbry.js +++ b/src/assets/javascripts/lbry.js @@ -17,10 +17,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.librarian = val librarianNormalRedirectsChecks = [...redirects.librarian.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = librarianNormalRedirectsChecks.indexOf(instance) if (a > -1) librarianNormalRedirectsChecks.splice(a, 1) } @@ -175,6 +175,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + librarianNormalRedirectsChecks = [...redirects.librarian.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = librarianNormalRedirectsChecks.indexOf(instance) + if (a > -1) librarianNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableLbryTargets: true, @@ -182,7 +188,7 @@ function initDefaults() { lbryTargetsRedirects: redirects, lbryRedirectType: "both", - librarianNormalRedirectsChecks: [...redirects.librarian.normal], + librarianNormalRedirectsChecks, librarianNormalCustomRedirects: [], librarianTorRedirectsChecks: [...redirects.librarian.tor], @@ -197,6 +203,7 @@ function initDefaults() { () => resolve() ) }) + }) }) } diff --git a/src/assets/javascripts/maps.js b/src/assets/javascripts/maps.js index 9fb10b9d..6627faff 100644 --- a/src/assets/javascripts/maps.js +++ b/src/assets/javascripts/maps.js @@ -21,10 +21,10 @@ redirects.osm = {} redirects.osm.normal = ["https://www.openstreetmap.org"] function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.facil = val facilNormalRedirectsChecks = [...redirects.facil.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = facilNormalRedirectsChecks.indexOf(instance) if (a > -1) facilNormalRedirectsChecks.splice(a, 1) } @@ -264,12 +264,18 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + facilNormalRedirectsChecks = [...redirects.facil.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = facilNormalRedirectsChecks.indexOf(instance) + if (a > -1) facilNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableMaps: false, mapsFrontend: "osm", mapsRedirects: redirects, - facilNormalRedirectsChecks: [...redirects.facil.normal], + facilNormalRedirectsChecks, facilNormalCustomRedirects: [], facilTorRedirectsChecks: [...redirects.facil.tor], @@ -284,6 +290,7 @@ function initDefaults() { () => resolve() ) }) + }) }) } diff --git a/src/assets/javascripts/medium.js b/src/assets/javascripts/medium.js index 4c03471c..f1dcf2e2 100644 --- a/src/assets/javascripts/medium.js +++ b/src/assets/javascripts/medium.js @@ -40,10 +40,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.scribe = val scribeNormalRedirectsChecks = [...redirects.scribe.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = scribeNormalRedirectsChecks.indexOf(instance) if (a > -1) scribeNormalRedirectsChecks.splice(a, 1) } @@ -181,18 +181,18 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { - scribeNormalRedirectsChecks = [...redirects.scribe.normal] - for (const instance of r.cloudflareBlackList) { - let i = scribeNormalRedirectsChecks.indexOf(instance) - if (i > -1) scribeNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + scribeNormalRedirectsChecks = [...redirects.scribe.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = scribeNormalRedirectsChecks.indexOf(instance) + if (a > -1) scribeNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableMedium: false, mediumRedirects: redirects, - scribeNormalRedirectsChecks: scribeNormalRedirectsChecks, + scribeNormalRedirectsChecks, scribeNormalCustomRedirects: [], scribeTorRedirectsChecks: [...redirects.scribe.tor], diff --git a/src/assets/javascripts/peertube.js b/src/assets/javascripts/peertube.js index de25cfaa..df95611c 100644 --- a/src/assets/javascripts/peertube.js +++ b/src/assets/javascripts/peertube.js @@ -15,10 +15,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.simpleertube = val simpleertubeNormalRedirectsChecks = [...redirects.simpleertube.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = simpleertubeNormalRedirectsChecks.indexOf(instance) if (a > -1) simpleertubeNormalRedirectsChecks.splice(a, 1) } @@ -162,19 +162,19 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { - simpleertubeNormalRedirectsChecks = [...redirects.simpleertube.normal] - for (const instance of r.cloudflareBlackList) { - let i = simpleertubeNormalRedirectsChecks.indexOf(instance) - if (i > -1) simpleertubeNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + simpleertubeNormalRedirectsChecks = [...redirects.simpleertube.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = simpleertubeNormalRedirectsChecks.indexOf(instance) + if (a > -1) simpleertubeNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { peerTubeTargets: ["https://search.joinpeertube.org", ...dataJson.peertube], disablePeertubeTargets: true, peertubeRedirects: redirects, - simpleertubeNormalRedirectsChecks: simpleertubeNormalRedirectsChecks, + simpleertubeNormalRedirectsChecks, simpleertubeNormalCustomRedirects: [], simpleertubeTorRedirectsChecks: [...redirects.simpleertube.tor], diff --git a/src/assets/javascripts/quora.js b/src/assets/javascripts/quora.js index 3f9e4189..4d8249f8 100644 --- a/src/assets/javascripts/quora.js +++ b/src/assets/javascripts/quora.js @@ -17,10 +17,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.quetre = val quetreNormalRedirectsChecks = [...redirects.quetre.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = quetreNormalRedirectsChecks.indexOf(instance) if (a > -1) quetreNormalRedirectsChecks.splice(a, 1) } @@ -157,13 +157,19 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + quetreNormalRedirectsChecks = [...redirects.quetre.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = quetreNormalRedirectsChecks.indexOf(instance) + if (a > -1) quetreNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableQuora: false, quoraRedirects: redirects, - quetreNormalRedirectsChecks: [...redirects.quetre.normal], + quetreNormalRedirectsChecks, quetreNormalCustomRedirects: [], quetreTorRedirectsChecks: [...redirects.quetre.tor], @@ -178,6 +184,7 @@ function initDefaults() { () => resolve() ) }) + }) }) } diff --git a/src/assets/javascripts/reddit.js b/src/assets/javascripts/reddit.js index d1bf7b99..2a07dffb 100644 --- a/src/assets/javascripts/reddit.js +++ b/src/assets/javascripts/reddit.js @@ -16,11 +16,11 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects = val libredditNormalRedirectsChecks = [...redirects.libreddit.normal] tedditNormalRedirectsChecks = [...redirects.teddit.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = libredditNormalRedirectsChecks.indexOf(instance) if (a > -1) libredditNormalRedirectsChecks.splice(a, 1) @@ -330,25 +330,23 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { - libredditNormalRedirectsChecks = [...redirects.libreddit.normal] - tedditNormalRedirectsChecks = [...redirects.teddit.normal] - for (const instance of r.cloudflareBlackList) { - let i - - i = libredditNormalRedirectsChecks.indexOf(instance) - if (i > -1) libredditNormalRedirectsChecks.splice(i, 1) - - i = tedditNormalRedirectsChecks.indexOf(instance) - if (i > -1) tedditNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + libredditNormalRedirectsChecks = [...redirects.libreddit.normal] + tedditNormalRedirectsChecks = [...redirects.teddit.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = libredditNormalRedirectsChecks.indexOf(instance) + if (a > -1) libredditNormalRedirectsChecks.splice(a, 1) + + const b = tedditNormalRedirectsChecks.indexOf(instance) + if (b > -1) tedditNormalRedirectsChecks.splice(b, 1) + } browser.storage.local.set( { disableReddit: false, redditFrontend: "libreddit", redditRedirects: redirects, - libredditNormalRedirectsChecks: libredditNormalRedirectsChecks, + libredditNormalRedirectsChecks, libredditNormalCustomRedirects: [], libredditTorRedirectsChecks: [...redirects.libreddit.tor], @@ -360,7 +358,7 @@ function initDefaults() { libredditLokiRedirectsChecks: [...redirects.libreddit.loki], libredditLokiCustomRedirects: [], - tedditNormalRedirectsChecks: tedditNormalRedirectsChecks, + tedditNormalRedirectsChecks, tedditNormalCustomRedirects: [], tedditTorRedirectsChecks: [...redirects.teddit.tor], diff --git a/src/assets/javascripts/reuters.js b/src/assets/javascripts/reuters.js index e4afa19c..78f5077b 100644 --- a/src/assets/javascripts/reuters.js +++ b/src/assets/javascripts/reuters.js @@ -17,10 +17,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.neuters = val neutersNormalRedirectsChecks = [...redirects.neuters.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = neutersNormalRedirectsChecks.indexOf(instance) if (a > -1) neutersNormalRedirectsChecks.splice(a, 1) } @@ -109,13 +109,19 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + neutersNormalRedirectsChecks = [...redirects.neuters.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = neutersNormalRedirectsChecks.indexOf(instance) + if (a > -1) neutersNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableReuters: true, reutersRedirects: redirects, - neutersNormalRedirectsChecks: [...redirects.neuters.normal], + neutersNormalRedirectsChecks, neutersNormalCustomRedirects: [], neutersTorRedirectsChecks: [...redirects.neuters.tor], @@ -130,6 +136,7 @@ function initDefaults() { () => resolve() ) }) + }) }) } diff --git a/src/assets/javascripts/search.js b/src/assets/javascripts/search.js index 2a5f4867..04b5b8d4 100644 --- a/src/assets/javascripts/search.js +++ b/src/assets/javascripts/search.js @@ -8,52 +8,22 @@ const frontends = new Array("searx", "searxng", "whoogle", "librex") const protocols = new Array("normal", "tor", "i2p", "loki") const redirects = {} -/* - "searx": { - "normal": [], - "tor": [], - "i2p": [] - }, - "searxng": { - "normal": [], - "tor": [], - "i2p": [] - }, - "whoogle": { - "normal": [], - "tor": [], - "i2p": [] - } - */ -//}; - -//let tmp = "{" for (let i = 0; i < frontends.length; i++) { - //redirects.frontends[i] = {} - //redirects.push(frontends[i]) - //tmp = frontends[i] - //tmp = tmp + '\n"' + frontends[i] + '": {' redirects[frontends[i]] = {} for (let x = 0; x < protocols.length; x++) { - //redirects.frontends[i].protocols = [] - //tmp = tmp + '\n"' + protocols[x] + '": [],' redirects[frontends[i]][protocols[x]] = [] } - //tmp = tmp + "\n}," } -//tmp = tmp + "\n}" - -//const redirects = JSON.parse(tmp) function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects = val searxNormalRedirectsChecks = [...redirects.searx.normal] searxngNormalRedirectsChecks = [...redirects.searxng.normal] whoogleNormalRedirectsChecks = [...redirects.whoogle.normal] librexNormalRedirectsChecks = [...redirects.librex.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = searxNormalRedirectsChecks.indexOf(instance) if (a > -1) searxNormalRedirectsChecks.splice(a, 1) @@ -499,35 +469,28 @@ function initDefaults() { .then(response => response.text()) .then(async data => { let dataJson = JSON.parse(data) - /* - redirects.searx = dataJson.searx; - redirects.searxng = dataJson.searxng; - redirects.whoogle = dataJson.whoogle; - */ for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { - whoogleNormalRedirectsChecks = [...redirects.whoogle.normal] - searxNormalRedirectsChecks = [...redirects.searx.normal] - searxngNormalRedirectsChecks = [...redirects.searxng.normal] - librexNormalRedirectsChecks = [...redirects.librex.normal] - for (const instance of r.cloudflareBlackList) { - let i - - i = whoogleNormalRedirectsChecks.indexOf(instance) - if (i > -1) whoogleNormalRedirectsChecks.splice(i, 1) + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + searxNormalRedirectsChecks = [...redirects.searx.normal] + searxngNormalRedirectsChecks = [...redirects.searxng.normal] + whoogleNormalRedirectsChecks = [...redirects.whoogle.normal] + librexNormalRedirectsChecks = [...redirects.librex.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = searxNormalRedirectsChecks.indexOf(instance) + if (a > -1) searxNormalRedirectsChecks.splice(a, 1) - i = searxNormalRedirectsChecks.indexOf(instance) - if (i > -1) searxNormalRedirectsChecks.splice(i, 1) + const b = searxngNormalRedirectsChecks.indexOf(instance) + if (b > -1) searxngNormalRedirectsChecks.splice(b, 1) - i = searxngNormalRedirectsChecks.indexOf(instance) - if (i > -1) searxngNormalRedirectsChecks.splice(i, 1) + const c = whoogleNormalRedirectsChecks.indexOf(instance) + if (c > -1) whoogleNormalRedirectsChecks.splice(c, 1) - i = librexNormalRedirectsChecks.indexOf(instance) - if (i > -1) librexNormalRedirectsChecks.splice(i, 1) - } + const d = librexNormalRedirectsChecks.indexOf(instance) + if (d > -1) librexNormalRedirectsChecks.splice(d, 1) + } browser.storage.local.set( { disableSearch: false, @@ -535,7 +498,7 @@ function initDefaults() { searchRedirects: redirects, searxngCustomSettings: false, - whoogleNormalRedirectsChecks: whoogleNormalRedirectsChecks, + whoogleNormalRedirectsChecks, whoogleNormalCustomRedirects: [], whoogleTorRedirectsChecks: [...redirects.whoogle.tor], @@ -547,7 +510,7 @@ function initDefaults() { whoogleLokiRedirectsChecks: [...redirects.whoogle.loki], whoogleLokiCustomRedirects: [], - searxNormalRedirectsChecks: searxNormalRedirectsChecks, + searxNormalRedirectsChecks, searxNormalCustomRedirects: [], searxTorRedirectsChecks: [...redirects.searx.tor], @@ -559,7 +522,7 @@ function initDefaults() { searxLokiRedirectsChecks: [...redirects.searx.loki], searxLokiCustomRedirects: [], - searxngNormalRedirectsChecks: searxngNormalRedirectsChecks, + searxngNormalRedirectsChecks, searxngNormalCustomRedirects: [], searxngTorRedirectsChecks: [...redirects.searxng.tor], @@ -571,7 +534,7 @@ function initDefaults() { searxngLokiRedirectsChecks: [...redirects.searxng.loki], searxngLokiCustomRedirects: [], - librexNormalRedirectsChecks: librexNormalRedirectsChecks, + librexNormalRedirectsChecks, librexNormalCustomRedirects: [], librexTorRedirectsChecks: [...redirects.librex.tor], diff --git a/src/assets/javascripts/sendTargets.js b/src/assets/javascripts/sendTargets.js index ba892fe3..c9ddfe2d 100644 --- a/src/assets/javascripts/sendTargets.js +++ b/src/assets/javascripts/sendTargets.js @@ -17,10 +17,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.send = val sendNormalRedirectsChecks = [...redirects.send.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = sendNormalRedirectsChecks.indexOf(instance) if (a > -1) sendNormalRedirectsChecks.splice(a, 1) } @@ -154,18 +154,18 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { - sendNormalRedirectsChecks = [...redirects.send.normal] - for (const instance of r.cloudflareBlackList) { - let i = sendNormalRedirectsChecks.indexOf(instance) - if (i > -1) sendNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + sendNormalRedirectsChecks = [...redirects.send.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = sendNormalRedirectsChecks.indexOf(instance) + if (a > -1) sendNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableSendTarget: false, sendTargetsRedirects: redirects, - sendNormalRedirectsChecks: sendNormalRedirectsChecks, + sendNormalRedirectsChecks, sendNormalCustomRedirects: [], sendTorRedirectsChecks: [...redirects.send.tor], diff --git a/src/assets/javascripts/tiktok.js b/src/assets/javascripts/tiktok.js index 9d2660d4..b7987422 100644 --- a/src/assets/javascripts/tiktok.js +++ b/src/assets/javascripts/tiktok.js @@ -17,10 +17,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.proxiTok = val proxiTokNormalRedirectsChecks = [...redirects.proxiTok.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = proxiTokNormalRedirectsChecks.indexOf(instance) if (a > -1) proxiTokNormalRedirectsChecks.splice(a, 1) } @@ -202,13 +202,20 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + proxiTokNormalRedirectsChecks = [...redirects.proxiTok.normal] + console.log(r) + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = proxiTokNormalRedirectsChecks.indexOf(instance) + if (a > -1) proxiTokNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableTiktok: false, tiktokRedirects: redirects, - proxiTokNormalRedirectsChecks: [...redirects.proxiTok.normal], + proxiTokNormalRedirectsChecks, proxiTokNormalCustomRedirects: [], proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor], @@ -223,6 +230,7 @@ function initDefaults() { () => resolve() ) }) + }) }) } diff --git a/src/assets/javascripts/translate/translate.js b/src/assets/javascripts/translate/translate.js index 2c500759..8da81d10 100644 --- a/src/assets/javascripts/translate/translate.js +++ b/src/assets/javascripts/translate/translate.js @@ -91,21 +91,21 @@ init() browser.storage.onChanged.addListener(init) function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects = val + simplyTranslateNormalRedirectsChecks = [...redirects.simplyTranslate.normal] lingvaNormalRedirectsChecks = [...redirects.lingva.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = simplyTranslateNormalCustomRedirects.indexOf(instance) + if (a > -1) simplyTranslateNormalCustomRedirects.splice(a, 1) + const i = lingvaNormalRedirectsChecks.indexOf(instance) if (i > -1) lingvaNormalRedirectsChecks.splice(i, 1) } browser.storage.local.set({ translateRedirects: redirects, - simplyTranslateNormalRedirectsChecks: redirects.simplyTranslate.normal, - simplyTranslateTorRedirectsChecks: redirects.simplyTranslate.tor, - simplyTranslateI2pRedirectsChecks: redirects.simplyTranslate.i2p, - simplyTranslateLokiRedirectsChecks: redirects.simplyTranslate.loki, + simplyTranslateNormalRedirectsChecks, lingvaNormalRedirectsChecks, - lingvaTorRedirectsChecks: redirects.lingva.tor, }) }) } @@ -309,19 +309,24 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { - lingvaNormalRedirectsChecks = [...redirects.lingva.normal] - for (const instance of r.cloudflareBlackList) { - const i = lingvaNormalRedirectsChecks.indexOf(instance) - if (i > -1) lingvaNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + simplyTranslateNormalCustomRedirects = [...redirects.simplyTranslate.normal] + lingvaNormalRedirectsChecks = [...redirects.lingva.normal] + console.log(r.offlineBlackList) + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = simplyTranslateNormalCustomRedirects.indexOf(instance) + if (a > -1) simplyTranslateNormalCustomRedirects.splice(a, 1) + + const b = lingvaNormalRedirectsChecks.indexOf(instance) + if (b > -1) lingvaNormalRedirectsChecks.splice(b, 1) + } browser.storage.local.set( { translateDisable: false, translateFrontend: "simplyTranslate", translateRedirects: redirects, - simplyTranslateNormalRedirectsChecks: [...redirects.simplyTranslate.normal], + simplyTranslateNormalRedirectsChecks, simplyTranslateNormalCustomRedirects: [], simplyTranslateTorRedirectsChecks: [...redirects.simplyTranslate.tor], @@ -333,7 +338,7 @@ function initDefaults() { simplyTranslateLokiRedirectsChecks: [...redirects.simplyTranslate.loki], simplyTranslateLokiCustomRedirects: [], - lingvaNormalRedirectsChecks: lingvaNormalRedirectsChecks, + lingvaNormalRedirectsChecks, lingvaNormalCustomRedirects: [], lingvaTorRedirectsChecks: [...redirects.lingva.tor], diff --git a/src/assets/javascripts/twitter.js b/src/assets/javascripts/twitter.js index b3c33560..83a9685d 100644 --- a/src/assets/javascripts/twitter.js +++ b/src/assets/javascripts/twitter.js @@ -17,17 +17,16 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList"], r => { + browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], r => { redirects.nitter = val nitterNormalRedirectsChecks = [...redirects.nitter.normal] - for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList]) { + for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { let i = nitterNormalRedirectsChecks.indexOf(instance) if (i > -1) nitterNormalRedirectsChecks.splice(i, 1) } browser.storage.local.set({ twitterRedirects: redirects, nitterNormalRedirectsChecks, - nitterTorRedirectsChecks: [...redirects.nitter.tor], }) }) } @@ -224,19 +223,19 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList"], async r => { - nitterNormalRedirectsChecks = [...redirects.nitter.normal] - for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList]) { - let i = nitterNormalRedirectsChecks.indexOf(instance) - if (i > -1) nitterNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { + nitterNormalRedirectsChecks = [...redirects.nitter.normal] + for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { + let i = nitterNormalRedirectsChecks.indexOf(instance) + if (i > -1) nitterNormalRedirectsChecks.splice(i, 1) + } browser.storage.local.set( { disableTwitter: false, twitterRedirects: redirects, twitterRedirectType: "both", - nitterNormalRedirectsChecks: nitterNormalRedirectsChecks, + nitterNormalRedirectsChecks, nitterNormalCustomRedirects: [], nitterTorRedirectsChecks: [...redirects.nitter.tor], @@ -251,7 +250,7 @@ function initDefaults() { () => resolve() ) }) - }) +}) }) } diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index d881eba1..c6cecc05 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -25,7 +25,7 @@ function getRandomInstance(instances) { let cloudflareBlackList = [] let authenticateBlackList = [] -let offlineBlacklist = [] +let offlineBlackList = [] async function initBlackList() { return new Promise(resolve => { fetch("/instances/blacklist.json") @@ -33,7 +33,7 @@ async function initBlackList() { .then(data => { cloudflareBlackList = JSON.parse(data).cloudflare authenticateBlackList = JSON.parse(data).authenticate - offlineBlacklist = JSON.parse(data).offlineBlacklist + offlineBlackList = JSON.parse(data).offline resolve() }) }) @@ -62,6 +62,7 @@ function updateInstances() { invidious: instances.invidious, piped: instances.piped, pipedMaterial: instances.pipedMaterial, + cloudtube: instances.cloudtube }) twitterHelper.setRedirects(instances.nitter) instagramHelper.setRedirects(instances.bibliogram) @@ -164,7 +165,7 @@ async function processDefaultCustomInstances(target, name, protocol, document) { ...redirects[name][protocol].map(x => { const cloudflare = cloudflareBlackList.includes(x) ? ' cloudflare' : "" const authenticate = authenticateBlackList.includes(x) ? ' authenticate' : "" - const offline = offlineBlacklist.includes(x) ? ' offline' : "" + const offline = offlineBlackList.includes(x) ? ' offline' : "" let ms = instancesLatency[x] let latencyColor = ms <= 1000 ? "green" : ms <= 2000 ? "orange" : "red" @@ -285,30 +286,22 @@ function pingOnce(href) { resolve(5000 + http.status) } } - } http.open("GET", `${href}?_=${new Date().getTime()}`, true) started = new Date().getTime() http.send(null) }) } - async function testLatency(element, instances, frontend) { return new Promise(async resolve => { let myList = {} let latencyThreshold let redirectsChecks = [] - browser.storage.local.get( - [ - "latencyThreshold", - `${frontend}NormalRedirectsChecks` - ], - r => { - latencyThreshold = r.latencyThreshold - redirectsChecks = r[`${frontend}NormalRedirectsChecks`] - } - ) + browser.storage.local.get(["latencyThreshold", `${frontend}NormalRedirectsChecks`], r => { + latencyThreshold = r.latencyThreshold + redirectsChecks = r[`${frontend}NormalRedirectsChecks`] + }) for (const href of instances) await ping(href).then(time => { if (time) { diff --git a/src/assets/javascripts/wikipedia.js b/src/assets/javascripts/wikipedia.js index 04191d1a..cecb3189 100644 --- a/src/assets/javascripts/wikipedia.js +++ b/src/assets/javascripts/wikipedia.js @@ -17,10 +17,10 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects.wikiless = val wikilessNormalRedirectsChecks = [...redirects.wikiless.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = wikilessNormalRedirectsChecks.indexOf(instance) if (a > -1) wikilessNormalRedirectsChecks.splice(a, 1) } @@ -200,18 +200,18 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { - wikilessNormalRedirectsChecks = [...redirects.wikiless.normal] - for (const instance of r.cloudflareBlackList) { - let i = wikilessNormalRedirectsChecks.indexOf(instance) - if (i > -1) wikilessNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + wikilessNormalRedirectsChecks = [...redirects.wikiless.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = wikilessNormalRedirectsChecks.indexOf(instance) + if (a > -1) wikilessNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableWikipedia: true, wikipediaRedirects: redirects, - wikilessNormalRedirectsChecks: wikilessNormalRedirectsChecks, + wikilessNormalRedirectsChecks, wikilessNormalCustomRedirects: [], wikilessTorRedirectsChecks: [...redirects.wikiless.tor], diff --git a/src/assets/javascripts/youtube/youtube.js b/src/assets/javascripts/youtube/youtube.js index 7e02dcd2..63e58d5b 100644 --- a/src/assets/javascripts/youtube/youtube.js +++ b/src/assets/javascripts/youtube/youtube.js @@ -30,14 +30,13 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { - for (let i = 0; i < frontends.length; i++) { - redirects.frontends = val.frontends - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { + redirects = val invidiousNormalRedirectsChecks = [...redirects.invidious.normal] pipedNormalRedirectsChecks = [...redirects.piped.normal] pipedMaterialNormalRedirectsChecks = [...redirects.pipedMaterial.normal] - for (const instance of r.cloudflareBlackList) { + cloudtubeNormalRedirectsChecks = [...redirects.cloudtube.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = invidiousNormalRedirectsChecks.indexOf(instance) if (a > -1) invidiousNormalRedirectsChecks.splice(a, 1) @@ -450,13 +449,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { invidiousNormalRedirectsChecks = [...redirects.invidious.normal] pipedNormalRedirectsChecks = [...redirects.piped.normal] pipedMaterialNormalRedirectsChecks = [...redirects.pipedMaterial.normal] cloudtubeNormalRedirectsChecks = [...redirects.cloudtube.normal] - - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = invidiousNormalRedirectsChecks.indexOf(instance) if (a > -1) invidiousNormalRedirectsChecks.splice(a, 1) @@ -467,9 +465,8 @@ function initDefaults() { if (c > -1) pipedMaterialNormalRedirectsChecks.splice(c, 1) const d = cloudtubeNormalRedirectsChecks.indexOf(instance) - if (d > -1) cloudtubeNormalRedirectsChecks.indexOf(instance) + if (c > -1) cloudtubeNormalRedirectsChecks.splice(d, 1) } - browser.storage.local.set( { disableYoutube: false, @@ -478,7 +475,7 @@ function initDefaults() { youtubeRedirects: redirects, youtubeFrontend: "invidious", - invidiousNormalRedirectsChecks: invidiousNormalRedirectsChecks, + invidiousNormalRedirectsChecks, invidiousNormalCustomRedirects: [], invidiousTorRedirectsChecks: [...redirects.invidious.tor], @@ -490,7 +487,7 @@ function initDefaults() { invidiousLokiRedirectsChecks: [...redirects.invidious.loki], invidiousLokiCustomRedirects: [], - pipedNormalRedirectsChecks: pipedNormalRedirectsChecks, + pipedNormalRedirectsChecks, pipedNormalCustomRedirects: [], pipedTorRedirectsChecks: [...redirects.piped.tor], diff --git a/src/assets/javascripts/youtubeMusic.js b/src/assets/javascripts/youtubeMusic.js index 3ff9a174..753ce7ad 100644 --- a/src/assets/javascripts/youtubeMusic.js +++ b/src/assets/javascripts/youtubeMusic.js @@ -19,11 +19,11 @@ for (let i = 0; i < frontends.length; i++) { } function setRedirects(val) { - browser.storage.local.get("cloudflareBlackList", r => { + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { redirects = val beatbumpNormalRedirectsChecks = [...redirects.beatbump.normal] hyperpipeNormalRedirectsChecks = [...redirects.hyperpipe.normal] - for (const instance of r.cloudflareBlackList) { + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { const a = beatbumpNormalRedirectsChecks.indexOf(instance) if (a > -1) beatbumpNormalRedirectsChecks.splice(a, 1) @@ -266,25 +266,23 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get("cloudflareBlackList", async r => { - beatbumpNormalRedirectsChecks = [...redirects.beatbump.normal] - hyperpipeNormalRedirectsChecks = [...redirects.hyperpipe.normal] - for (const instance of r.cloudflareBlackList) { - let i - - i = beatbumpNormalRedirectsChecks.indexOf(instance) - if (i > -1) beatbumpNormalRedirectsChecks.splice(i, 1) - - i = hyperpipeNormalRedirectsChecks.indexOf(instance) - if (i > -1) hyperpipeNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + beatbumpNormalRedirectsChecks = [...redirects.beatbump.normal] + hyperpipeNormalRedirectsChecks = [...redirects.hyperpipe.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = beatbumpNormalRedirectsChecks.indexOf(instance) + if (a > -1) beatbumpNormalRedirectsChecks.splice(a, 1) + + const b = hyperpipeNormalRedirectsChecks.indexOf(instance) + if (b > -1) hyperpipeNormalRedirectsChecks.splice(b, 1) + } browser.storage.local.set( { disableYoutubeMusic: false, youtubeMusicFrontend: "hyperpipe", youtubeMusicRedirects: redirects, - beatbumpNormalRedirectsChecks: beatbumpNormalRedirectsChecks, + beatbumpNormalRedirectsChecks, beatbumpNormalCustomRedirects: [], beatbumpTorRedirectsChecks: [...redirects.beatbump.tor], @@ -296,7 +294,7 @@ function initDefaults() { beatbumpLokiRedirectsChecks: [...redirects.beatbump.loki], beatbumpLokiCustomRedirects: [], - hyperpipeNormalRedirectsChecks: hyperpipeNormalRedirectsChecks, + hyperpipeNormalRedirectsChecks, hyperpipeNormalCustomRedirects: [], hyperpipeTorRedirectsChecks: [...redirects.hyperpipe.tor], diff --git a/src/pages/background/background.js b/src/pages/background/background.js index a1b0c9c6..c6e9ab7a 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -32,25 +32,27 @@ browser.runtime.onInstalled.addListener(details => { browser.storage.local.clear(() => { browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare }, () => { browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate }, () => { - generalHelper.initDefaults() - youtubeHelper.initDefaults() - youtubeMusicHelper.initDefaults() - twitterHelper.initDefaults() - instagramHelper.initDefaults() - mapsHelper.initDefaults() - searchHelper.initDefaults() - translateHelper.initDefaults() - mediumHelper.initDefaults() - quoraHelper.initDefaults() - libremdbHelper.initDefaults() - reutersHelper.initDefaults() - redditHelper.initDefaults() - wikipediaHelper.initDefaults() - imgurHelper.initDefaults() - tiktokHelper.initDefaults() - sendTargetsHelper.initDefaults() - peertubeHelper.initDefaults() - lbryHelper.initDefaults() + browser.storage.local.set({ offlineBlackList: JSON.parse(data).offline }, () => { + generalHelper.initDefaults() + youtubeHelper.initDefaults() + youtubeMusicHelper.initDefaults() + twitterHelper.initDefaults() + instagramHelper.initDefaults() + mapsHelper.initDefaults() + searchHelper.initDefaults() + translateHelper.initDefaults() + mediumHelper.initDefaults() + quoraHelper.initDefaults() + libremdbHelper.initDefaults() + reutersHelper.initDefaults() + redditHelper.initDefaults() + wikipediaHelper.initDefaults() + imgurHelper.initDefaults() + tiktokHelper.initDefaults() + sendTargetsHelper.initDefaults() + peertubeHelper.initDefaults() + lbryHelper.initDefaults() + }) }) }) }) diff --git a/src/pages/options/index.html b/src/pages/options/index.html index afad0bf9..077b3da2 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -3186,4 +3186,4 @@ - \ No newline at end of file + diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js index c64eb25d..4ef30cec 100644 --- a/src/pages/options/widgets/general.js +++ b/src/pages/options/widgets/general.js @@ -81,6 +81,7 @@ resetSettings.addEventListener("click", async () => { .then(response => response.text()) .then(async data => { browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare }, () => { + browser.storage.local.set({ offlineBlackList: JSON.parse(data).offline }, () => { browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate }, async () => { await generalHelper.initDefaults() await youtubeHelper.initDefaults() @@ -103,6 +104,7 @@ resetSettings.addEventListener("click", async () => { await lbryHelper.initDefaults() location.reload() }) + }) }) }) }) -- cgit 1.4.1 From f7fbe4a912c8caa4d1c41e642379f4cebfdcf05f Mon Sep 17 00:00:00 2001 From: BobIsMyManager Date: Tue, 2 Aug 2022 22:46:31 +0100 Subject: Make fetching non-normal instances actually work --- src/assets/javascripts/imdb.js | 3 +++ src/assets/javascripts/imgur.js | 3 +++ src/assets/javascripts/instagram.js | 3 +++ src/assets/javascripts/lbry.js | 3 +++ src/assets/javascripts/maps.js | 3 +++ src/assets/javascripts/medium.js | 3 +++ src/assets/javascripts/peertube.js | 3 +++ src/assets/javascripts/quora.js | 3 +++ src/assets/javascripts/reddit.js | 6 ++++++ src/assets/javascripts/reuters.js | 3 +++ src/assets/javascripts/search.js | 12 ++++++++++++ src/assets/javascripts/sendTargets.js | 3 +++ src/assets/javascripts/tiktok.js | 3 +++ src/assets/javascripts/translate/translate.js | 6 ++++++ src/assets/javascripts/twitter.js | 3 +++ src/assets/javascripts/wikipedia.js | 3 +++ src/assets/javascripts/youtube/youtube.js | 12 ++++++++++++ src/assets/javascripts/youtubeMusic.js | 6 ++++++ 18 files changed, 81 insertions(+) (limited to 'src/assets/javascripts/tiktok.js') diff --git a/src/assets/javascripts/imdb.js b/src/assets/javascripts/imdb.js index 1f6c7a5f..9b235280 100644 --- a/src/assets/javascripts/imdb.js +++ b/src/assets/javascripts/imdb.js @@ -27,6 +27,9 @@ function setRedirects(val) { browser.storage.local.set({ imdbRedirects: redirects, libremdbNormalRedirectsChecks, + libremdbTorRedirectsChecks: [...redirects.libremdb.tor], + libremdbI2pRedirectsChecks: [...redirects.libremdb.i2p], + libremdbLokiRedirectsChecks: [...redirects.libremdb.loki] }) }) } diff --git a/src/assets/javascripts/imgur.js b/src/assets/javascripts/imgur.js index 25f61f06..6b943845 100644 --- a/src/assets/javascripts/imgur.js +++ b/src/assets/javascripts/imgur.js @@ -27,6 +27,9 @@ function setRedirects(val) { browser.storage.local.set({ imgurRedirects: redirects, rimgoNormalRedirectsChecks, + rimgoTorRedirectsChecks: [...redirects.rimgo.tor], + rimgoI2pRedirectsChecks: [...redirects.rimgo.i2p], + rimgoLokiRedirectsChecks: [...redirects.rimgo.loki] }) }) } diff --git a/src/assets/javascripts/instagram.js b/src/assets/javascripts/instagram.js index a65dac80..4908f5a3 100644 --- a/src/assets/javascripts/instagram.js +++ b/src/assets/javascripts/instagram.js @@ -26,6 +26,9 @@ function setRedirects(val) { browser.storage.local.set({ instagramRedirects: redirects, bibliogramNormalRedirectsChecks, + bibliogramTorRedirectsChecks: [...redirects.bibliogram.tor], + bibliogramI2pRedirectsChecks: [...redirects.bibliogram.i2p], + bibliogramLokiRedirectsChecks: [...redirects.bibliogram.loki] }) }) } diff --git a/src/assets/javascripts/lbry.js b/src/assets/javascripts/lbry.js index b1e6f477..6ca058eb 100644 --- a/src/assets/javascripts/lbry.js +++ b/src/assets/javascripts/lbry.js @@ -27,6 +27,9 @@ function setRedirects(val) { browser.storage.local.set({ lbryTargetsRedirects: redirects, librarianNormalRedirectsChecks, + librarianTorRedirectsChecks: [...redirects.librarian.tor], + librarianI2pRedirectsChecks: [...redirects.librarian.i2p], + librarianLokiRedirectsChecks: [...redirects.librarian.loki] }) }) } diff --git a/src/assets/javascripts/maps.js b/src/assets/javascripts/maps.js index 6627faff..79fd7a66 100644 --- a/src/assets/javascripts/maps.js +++ b/src/assets/javascripts/maps.js @@ -31,6 +31,9 @@ function setRedirects(val) { browser.storage.local.set({ mapsRedirects: redirects, facilNormalRedirectsChecks, + facilTorRedirectsChecks: [...redirects.facil.tor], + facilI2pRedirectsChecks: [...redirects.facil.i2p], + facilLokiRedirectsChecks: [...redirects.facil.loki] }) }) } diff --git a/src/assets/javascripts/medium.js b/src/assets/javascripts/medium.js index f1dcf2e2..2d63eb4d 100644 --- a/src/assets/javascripts/medium.js +++ b/src/assets/javascripts/medium.js @@ -50,6 +50,9 @@ function setRedirects(val) { browser.storage.local.set({ mediumRedirects: redirects, scribeNormalRedirectsChecks, + scribeTorRedirectsChecks: [...redirects.scribe.tor], + scribeI2pRedirectsChecks: [...redirects.scribe.i2p], + scribeLokiRedirectsChecks: [...redirects.scribe.loki] }) }) } diff --git a/src/assets/javascripts/peertube.js b/src/assets/javascripts/peertube.js index df95611c..9819c01a 100644 --- a/src/assets/javascripts/peertube.js +++ b/src/assets/javascripts/peertube.js @@ -25,6 +25,9 @@ function setRedirects(val) { browser.storage.local.set({ peertubeRedirects: redirects, simpleertubeNormalRedirectsChecks, + simpleertubeTorRedirectsChecks: [...redirects.simpleertube.tor], + simpleertubeI2pRedirectsChecks: [...redirects.simpleertube.i2p], + simpleertubeLokiRedirectsChecks: [...redirects.simpleertube.loki] }) }) } diff --git a/src/assets/javascripts/quora.js b/src/assets/javascripts/quora.js index 4d8249f8..e2412135 100644 --- a/src/assets/javascripts/quora.js +++ b/src/assets/javascripts/quora.js @@ -27,6 +27,9 @@ function setRedirects(val) { browser.storage.local.set({ quoraRedirects: redirects, quetreNormalRedirectsChecks, + quetreTorRedirectsChecks: [...redirects.quetre.tor], + quetreI2pRedirectsChecks: [...redirects.quetre.i2p], + quetreLokiRedirectsChecks: [...redirects.quetre.loki] }) }) } diff --git a/src/assets/javascripts/reddit.js b/src/assets/javascripts/reddit.js index 2a07dffb..0d324e9e 100644 --- a/src/assets/javascripts/reddit.js +++ b/src/assets/javascripts/reddit.js @@ -30,7 +30,13 @@ function setRedirects(val) { browser.storage.local.set({ redditRedirects: redirects, libredditNormalRedirectsChecks, + libredditTorRedirectsChecks: [...redirects.libreddit.tor], + libredditI2pRedirectsChecks: [...redirects.libreddit.i2p], + libredditLokiRedirectsChecks: [...redirects.libreddit.loki], tedditNormalRedirectsChecks, + tedditTorRedirectsChecks: [...redirects.teddit.tor], + tedditI2pRedirectsChecks: [...redirects.teddit.i2p], + tedditLokiRedirectsChecks: [...redirects.teddit.loki] }) }) } diff --git a/src/assets/javascripts/reuters.js b/src/assets/javascripts/reuters.js index 78f5077b..d1a0710b 100644 --- a/src/assets/javascripts/reuters.js +++ b/src/assets/javascripts/reuters.js @@ -27,6 +27,9 @@ function setRedirects(val) { browser.storage.local.set({ neutersRedirects: redirects, neutersNormalRedirectsChecks, + neutersTorRedirectsChecks: [...redirects.neuters.tor], + neutersI2pRedirectsChecks: [...redirects.neuters.i2p], + neutersLokiRedirectsChecks: [...redirects.neuters.loki] }) }) } diff --git a/src/assets/javascripts/search.js b/src/assets/javascripts/search.js index 04b5b8d4..7a137eaf 100644 --- a/src/assets/javascripts/search.js +++ b/src/assets/javascripts/search.js @@ -39,9 +39,21 @@ function setRedirects(val) { browser.storage.local.set({ searchRedirects: redirects, searxNormalRedirectsChecks, + searxTorRedirectsChecks: [...redirects.searx.tor], + searxI2pRedirectsChecks: [...redirects.searx.i2p], + searxLokiRedirectsChecks: [...redirects.searx.loki], searxngNormalRedirectsChecks, + searxngTorRedirectsChecks: [...redirects.searxng.tor], + searxngI2pRedirectsChecks: [...redirects.searxng.i2p], + searxngLokiRedirectsChecks: [...redirects.searxng.loki], whoogleNormalRedirectsChecks, + whoogleTorRedirectsChecks: [...redirects.whoogle.tor], + whoogleI2pRedirectsChecks: [...redirects.whoogle.i2p], + whoogleLokiRedirectsChecks: [...redirects.whoogle.loki], librexNormalRedirectsChecks, + librexTorRedirectsChecks: [...redirects.librex.tor], + librexI2pRedirectsChecks: [...redirects.librex.i2p], + librexLokiRedirectsChecks: [...redirects.librex.loki] }) }) } diff --git a/src/assets/javascripts/sendTargets.js b/src/assets/javascripts/sendTargets.js index c9ddfe2d..d17e969d 100644 --- a/src/assets/javascripts/sendTargets.js +++ b/src/assets/javascripts/sendTargets.js @@ -27,6 +27,9 @@ function setRedirects(val) { browser.storage.local.set({ sendTargetsRedirects: redirects, sendNormalRedirectsChecks, + sendTorRedirectsChecks: [...redirects.send.tor], + sendI2pRedirectsChecks: [...redirects.send.i2p], + sendLokiRedirectsChecks: [...redirects.send.loki] }) }) } diff --git a/src/assets/javascripts/tiktok.js b/src/assets/javascripts/tiktok.js index b7987422..924aa81f 100644 --- a/src/assets/javascripts/tiktok.js +++ b/src/assets/javascripts/tiktok.js @@ -27,6 +27,9 @@ function setRedirects(val) { browser.storage.local.set({ tiktokRedirects: redirects, proxiTokNormalRedirectsChecks, + proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor], + proxiTokI2pRedirectsChecks: [...redirects.proxiTok.i2p], + proxiTokLokiRedirectsChecks: [...redirects.proxiTok.loki] }) }) } diff --git a/src/assets/javascripts/translate/translate.js b/src/assets/javascripts/translate/translate.js index 8da81d10..2e55c61b 100644 --- a/src/assets/javascripts/translate/translate.js +++ b/src/assets/javascripts/translate/translate.js @@ -105,7 +105,13 @@ function setRedirects(val) { browser.storage.local.set({ translateRedirects: redirects, simplyTranslateNormalRedirectsChecks, + simplyTranslateTorRedirectsChecks: [...redirects.simplyTranslate.tor], + simplyTranslateI2pRedirectsChecks: [...redirects.simplyTranslate.i2p], + simplyTranslateLokiRedirectsChecks: [...redirects.simplyTranslate.loki], lingvaNormalRedirectsChecks, + lingvaTorRedirectsChecks: [...redirects.lingva.tor], + lingvaI2pRedirectsChecks: [...redirects.lingva.i2p], + lingvaLokiRedirectsChecks: [...redirects.lingva.loki] }) }) } diff --git a/src/assets/javascripts/twitter.js b/src/assets/javascripts/twitter.js index 83a9685d..8131fbc2 100644 --- a/src/assets/javascripts/twitter.js +++ b/src/assets/javascripts/twitter.js @@ -27,6 +27,9 @@ function setRedirects(val) { browser.storage.local.set({ twitterRedirects: redirects, nitterNormalRedirectsChecks, + nitterTorRedirectsChecks: [...redirects.nitter.tor], + nitterI2pRedirectsChecks: [...redirects.nitter.i2p], + nitterLokiRedirectsChecks: [...redirects.nitter.loki] }) }) } diff --git a/src/assets/javascripts/wikipedia.js b/src/assets/javascripts/wikipedia.js index cecb3189..c72cb804 100644 --- a/src/assets/javascripts/wikipedia.js +++ b/src/assets/javascripts/wikipedia.js @@ -27,6 +27,9 @@ function setRedirects(val) { browser.storage.local.set({ wikipediaRedirects: redirects, wikilessNormalRedirectsChecks, + wikilessTorRedirectsChecks: [...redirects.wikiless.tor], + wikilessI2pRedirectsChecks: [...redirects.wikiless.i2p], + wikilessLokiRedirectsChecks: [...redirects.wikiless.loki] }) }) } diff --git a/src/assets/javascripts/youtube/youtube.js b/src/assets/javascripts/youtube/youtube.js index 63e58d5b..b08ff909 100644 --- a/src/assets/javascripts/youtube/youtube.js +++ b/src/assets/javascripts/youtube/youtube.js @@ -52,9 +52,21 @@ function setRedirects(val) { browser.storage.local.set({ youtubeRedirects: redirects, invidiousNormalRedirectsChecks, + invidiousTorRedirectsChecks: [...redirects.invidious.tor], + invidiousI2pRedirectsChecks: [...redirects.invidious.i2p], + invidiousLokiRedirectsChecks: [...redirects.invidious.loki], pipedNormalRedirectsChecks, + pipedTorRedirectsChecks: [...redirects.piped.tor], + pipedI2pRedirectsChecks: [...redirects.piped.i2p], + pipedLokiRedirectsChecks: [...redirects.piped.loki], pipedMaterialNormalRedirectsChecks, + pipedMaterialTorRedirectsChecks: [...redirects.pipedMaterial.tor], + pipedMaterialI2pRedirectsChecks: [...redirects.pipedMaterial.i2p], + pipedMaterialLokiRedirectsChecks: [...redirects.pipedMaterial.loki], cloudtubeNormalRedirectsChecks, + cloudtubeTorRedirectsChecks: [...redirects.cloudtube.tor], + cloudtubeI2pRedirectsChecks: [...redirects.cloudtube.i2p], + cloudtubeLokiRedirectsChecks: [...redirects.cloudtube.loki] }) }) } diff --git a/src/assets/javascripts/youtubeMusic.js b/src/assets/javascripts/youtubeMusic.js index 753ce7ad..f0b44e1f 100644 --- a/src/assets/javascripts/youtubeMusic.js +++ b/src/assets/javascripts/youtubeMusic.js @@ -33,7 +33,13 @@ function setRedirects(val) { browser.storage.local.set({ youtubeMusicRedirects: redirects, beatbumpNormalRedirectsChecks, + beatbumpTorRedirectsChecks: [...redirects.beatbump.tor], + beatbumpI2pRedirectsChecks: [...redirects.beatbump.i2p], + beatbumpLokiRedirectsChecks: [...redirects.beatbump.loki], hyperpipeNormalRedirectsChecks, + hyperpipeTorRedirectsChecks: [...redirects.hyperpipe.tor], + hyperpipeI2pRedirectsChecks: [...redirects.hyperpipe.i2p], + hyperpipeLokiRedirectsChecks: [...redirects.hyperpipe.loki] }) }) } -- cgit 1.4.1 From 9959aeb4eaef177e77c00328fb9be72c33c17872 Mon Sep 17 00:00:00 2001 From: BobIsMyManager Date: Tue, 2 Aug 2022 23:04:04 +0100 Subject: Fix simplytranslate and make things prettier --- src/assets/javascripts/general.js | 2 +- src/assets/javascripts/imdb.js | 54 ++++++++++++------------- src/assets/javascripts/imgur.js | 14 +++---- src/assets/javascripts/instagram.js | 14 +++---- src/assets/javascripts/lbry.js | 58 +++++++++++++-------------- src/assets/javascripts/maps.js | 54 ++++++++++++------------- src/assets/javascripts/medium.js | 14 +++---- src/assets/javascripts/peertube.js | 14 +++---- src/assets/javascripts/quora.js | 56 +++++++++++++------------- src/assets/javascripts/reddit.js | 22 +++++----- src/assets/javascripts/reuters.js | 56 +++++++++++++------------- src/assets/javascripts/search.js | 32 +++++++-------- src/assets/javascripts/sendTargets.js | 14 +++---- src/assets/javascripts/tiktok.js | 57 +++++++++++++------------- src/assets/javascripts/translate/translate.js | 29 +++++++------- src/assets/javascripts/twitter.js | 16 ++++---- src/assets/javascripts/utils.js | 2 +- src/assets/javascripts/wikipedia.js | 14 +++---- src/assets/javascripts/youtube/youtube.js | 4 +- src/assets/javascripts/youtubeMusic.js | 22 +++++----- 20 files changed, 273 insertions(+), 275 deletions(-) (limited to 'src/assets/javascripts/tiktok.js') diff --git a/src/assets/javascripts/general.js b/src/assets/javascripts/general.js index 113dc6f7..a8360bd5 100644 --- a/src/assets/javascripts/general.js +++ b/src/assets/javascripts/general.js @@ -32,7 +32,7 @@ async function initDefaults() { firstPartyIsolate: false, protocol: "normal", protocolFallback: true, - latencyThreshold: 1000 + latencyThreshold: 1000, }, () => resolve() ) diff --git a/src/assets/javascripts/imdb.js b/src/assets/javascripts/imdb.js index 9b235280..57368557 100644 --- a/src/assets/javascripts/imdb.js +++ b/src/assets/javascripts/imdb.js @@ -29,7 +29,7 @@ function setRedirects(val) { libremdbNormalRedirectsChecks, libremdbTorRedirectsChecks: [...redirects.libremdb.tor], libremdbI2pRedirectsChecks: [...redirects.libremdb.i2p], - libremdbLokiRedirectsChecks: [...redirects.libremdb.loki] + libremdbLokiRedirectsChecks: [...redirects.libremdb.loki], }) }) } @@ -175,32 +175,32 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - libremdbNormalRedirectsChecks = [...redirects.libremdb.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = libremdbNormalRedirectsChecks.indexOf(instance) - if (a > -1) libremdbNormalRedirectsChecks.splice(a, 1) - } - browser.storage.local.set( - { - disableImdb: true, - imdbRedirects: redirects, - - libremdbNormalRedirectsChecks, - libremdbNormalCustomRedirects: [], - - libremdbTorRedirectsChecks: [...redirects.libremdb.tor], - libremdbTorCustomRedirects: [], - - libremdbI2pRedirectsChecks: [], - libremdbI2pCustomRedirects: [], - - libremdbLokiRedirectsChecks: [], - libremdbLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + libremdbNormalRedirectsChecks = [...redirects.libremdb.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = libremdbNormalRedirectsChecks.indexOf(instance) + if (a > -1) libremdbNormalRedirectsChecks.splice(a, 1) + } + browser.storage.local.set( + { + disableImdb: true, + imdbRedirects: redirects, + + libremdbNormalRedirectsChecks, + libremdbNormalCustomRedirects: [], + + libremdbTorRedirectsChecks: [...redirects.libremdb.tor], + libremdbTorCustomRedirects: [], + + libremdbI2pRedirectsChecks: [], + libremdbI2pCustomRedirects: [], + + libremdbLokiRedirectsChecks: [], + libremdbLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/imgur.js b/src/assets/javascripts/imgur.js index 6b943845..15b9ccac 100644 --- a/src/assets/javascripts/imgur.js +++ b/src/assets/javascripts/imgur.js @@ -29,7 +29,7 @@ function setRedirects(val) { rimgoNormalRedirectsChecks, rimgoTorRedirectsChecks: [...redirects.rimgo.tor], rimgoI2pRedirectsChecks: [...redirects.rimgo.i2p], - rimgoLokiRedirectsChecks: [...redirects.rimgo.loki] + rimgoLokiRedirectsChecks: [...redirects.rimgo.loki], }) }) } @@ -177,12 +177,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - rimgoNormalRedirectsChecks = [...redirects.rimgo.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = rimgoNormalRedirectsChecks.indexOf(instance) - if (a > -1) rimgoNormalRedirectsChecks.splice(a, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + rimgoNormalRedirectsChecks = [...redirects.rimgo.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = rimgoNormalRedirectsChecks.indexOf(instance) + if (a > -1) rimgoNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableImgur: false, diff --git a/src/assets/javascripts/instagram.js b/src/assets/javascripts/instagram.js index 4908f5a3..d0aa07c0 100644 --- a/src/assets/javascripts/instagram.js +++ b/src/assets/javascripts/instagram.js @@ -28,7 +28,7 @@ function setRedirects(val) { bibliogramNormalRedirectsChecks, bibliogramTorRedirectsChecks: [...redirects.bibliogram.tor], bibliogramI2pRedirectsChecks: [...redirects.bibliogram.i2p], - bibliogramLokiRedirectsChecks: [...redirects.bibliogram.loki] + bibliogramLokiRedirectsChecks: [...redirects.bibliogram.loki], }) }) } @@ -206,12 +206,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - bibliogramNormalRedirectsChecks = [...redirects.bibliogram.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = bibliogramNormalRedirectsChecks.indexOf(instance) - if (a > -1) bibliogramNormalRedirectsChecks.splice(a, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + bibliogramNormalRedirectsChecks = [...redirects.bibliogram.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = bibliogramNormalRedirectsChecks.indexOf(instance) + if (a > -1) bibliogramNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set({ disableInstagram: false, instagramRedirects: redirects, diff --git a/src/assets/javascripts/lbry.js b/src/assets/javascripts/lbry.js index 6ca058eb..5e285ada 100644 --- a/src/assets/javascripts/lbry.js +++ b/src/assets/javascripts/lbry.js @@ -29,7 +29,7 @@ function setRedirects(val) { librarianNormalRedirectsChecks, librarianTorRedirectsChecks: [...redirects.librarian.tor], librarianI2pRedirectsChecks: [...redirects.librarian.i2p], - librarianLokiRedirectsChecks: [...redirects.librarian.loki] + librarianLokiRedirectsChecks: [...redirects.librarian.loki], }) }) } @@ -178,34 +178,34 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - librarianNormalRedirectsChecks = [...redirects.librarian.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = librarianNormalRedirectsChecks.indexOf(instance) - if (a > -1) librarianNormalRedirectsChecks.splice(a, 1) - } - browser.storage.local.set( - { - disableLbryTargets: true, - lbryFrontend: "librarian", - lbryTargetsRedirects: redirects, - lbryRedirectType: "both", - - librarianNormalRedirectsChecks, - librarianNormalCustomRedirects: [], - - librarianTorRedirectsChecks: [...redirects.librarian.tor], - librarianTorCustomRedirects: [], - - librarianI2pRedirectsChecks: [...redirects.librarian.i2p], - librarianI2pCustomRedirects: [], - - librarianLokiRedirectsChecks: [...redirects.librarian.loki], - librarianLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + librarianNormalRedirectsChecks = [...redirects.librarian.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = librarianNormalRedirectsChecks.indexOf(instance) + if (a > -1) librarianNormalRedirectsChecks.splice(a, 1) + } + browser.storage.local.set( + { + disableLbryTargets: true, + lbryFrontend: "librarian", + lbryTargetsRedirects: redirects, + lbryRedirectType: "both", + + librarianNormalRedirectsChecks, + librarianNormalCustomRedirects: [], + + librarianTorRedirectsChecks: [...redirects.librarian.tor], + librarianTorCustomRedirects: [], + + librarianI2pRedirectsChecks: [...redirects.librarian.i2p], + librarianI2pCustomRedirects: [], + + librarianLokiRedirectsChecks: [...redirects.librarian.loki], + librarianLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/maps.js b/src/assets/javascripts/maps.js index 79fd7a66..6e3c9af0 100644 --- a/src/assets/javascripts/maps.js +++ b/src/assets/javascripts/maps.js @@ -33,7 +33,7 @@ function setRedirects(val) { facilNormalRedirectsChecks, facilTorRedirectsChecks: [...redirects.facil.tor], facilI2pRedirectsChecks: [...redirects.facil.i2p], - facilLokiRedirectsChecks: [...redirects.facil.loki] + facilLokiRedirectsChecks: [...redirects.facil.loki], }) }) } @@ -267,32 +267,32 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - facilNormalRedirectsChecks = [...redirects.facil.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = facilNormalRedirectsChecks.indexOf(instance) - if (a > -1) facilNormalRedirectsChecks.splice(a, 1) - } - browser.storage.local.set( - { - disableMaps: false, - mapsFrontend: "osm", - mapsRedirects: redirects, - facilNormalRedirectsChecks, - facilNormalCustomRedirects: [], - - facilTorRedirectsChecks: [...redirects.facil.tor], - facilTorCustomRedirects: [], - - facilI2pRedirectsChecks: [...redirects.facil.i2p], - facilI2pCustomRedirects: [], - - facilLokiRedirectsChecks: [...redirects.facil.loki], - facilLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + facilNormalRedirectsChecks = [...redirects.facil.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = facilNormalRedirectsChecks.indexOf(instance) + if (a > -1) facilNormalRedirectsChecks.splice(a, 1) + } + browser.storage.local.set( + { + disableMaps: false, + mapsFrontend: "osm", + mapsRedirects: redirects, + facilNormalRedirectsChecks, + facilNormalCustomRedirects: [], + + facilTorRedirectsChecks: [...redirects.facil.tor], + facilTorCustomRedirects: [], + + facilI2pRedirectsChecks: [...redirects.facil.i2p], + facilI2pCustomRedirects: [], + + facilLokiRedirectsChecks: [...redirects.facil.loki], + facilLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/medium.js b/src/assets/javascripts/medium.js index 2d63eb4d..e5cb1dc4 100644 --- a/src/assets/javascripts/medium.js +++ b/src/assets/javascripts/medium.js @@ -52,7 +52,7 @@ function setRedirects(val) { scribeNormalRedirectsChecks, scribeTorRedirectsChecks: [...redirects.scribe.tor], scribeI2pRedirectsChecks: [...redirects.scribe.i2p], - scribeLokiRedirectsChecks: [...redirects.scribe.loki] + scribeLokiRedirectsChecks: [...redirects.scribe.loki], }) }) } @@ -184,12 +184,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - scribeNormalRedirectsChecks = [...redirects.scribe.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = scribeNormalRedirectsChecks.indexOf(instance) - if (a > -1) scribeNormalRedirectsChecks.splice(a, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + scribeNormalRedirectsChecks = [...redirects.scribe.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = scribeNormalRedirectsChecks.indexOf(instance) + if (a > -1) scribeNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableMedium: false, diff --git a/src/assets/javascripts/peertube.js b/src/assets/javascripts/peertube.js index 9819c01a..478a18f0 100644 --- a/src/assets/javascripts/peertube.js +++ b/src/assets/javascripts/peertube.js @@ -27,7 +27,7 @@ function setRedirects(val) { simpleertubeNormalRedirectsChecks, simpleertubeTorRedirectsChecks: [...redirects.simpleertube.tor], simpleertubeI2pRedirectsChecks: [...redirects.simpleertube.i2p], - simpleertubeLokiRedirectsChecks: [...redirects.simpleertube.loki] + simpleertubeLokiRedirectsChecks: [...redirects.simpleertube.loki], }) }) } @@ -165,12 +165,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - simpleertubeNormalRedirectsChecks = [...redirects.simpleertube.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = simpleertubeNormalRedirectsChecks.indexOf(instance) - if (a > -1) simpleertubeNormalRedirectsChecks.splice(a, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + simpleertubeNormalRedirectsChecks = [...redirects.simpleertube.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = simpleertubeNormalRedirectsChecks.indexOf(instance) + if (a > -1) simpleertubeNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { peerTubeTargets: ["https://search.joinpeertube.org", ...dataJson.peertube], diff --git a/src/assets/javascripts/quora.js b/src/assets/javascripts/quora.js index e2412135..578cfe76 100644 --- a/src/assets/javascripts/quora.js +++ b/src/assets/javascripts/quora.js @@ -29,7 +29,7 @@ function setRedirects(val) { quetreNormalRedirectsChecks, quetreTorRedirectsChecks: [...redirects.quetre.tor], quetreI2pRedirectsChecks: [...redirects.quetre.i2p], - quetreLokiRedirectsChecks: [...redirects.quetre.loki] + quetreLokiRedirectsChecks: [...redirects.quetre.loki], }) }) } @@ -160,33 +160,33 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - quetreNormalRedirectsChecks = [...redirects.quetre.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = quetreNormalRedirectsChecks.indexOf(instance) - if (a > -1) quetreNormalRedirectsChecks.splice(a, 1) - } - browser.storage.local.set( - { - disableQuora: false, - - quoraRedirects: redirects, - - quetreNormalRedirectsChecks, - quetreNormalCustomRedirects: [], - - quetreTorRedirectsChecks: [...redirects.quetre.tor], - quetreTorCustomRedirects: [], - - quetreI2pRedirectsChecks: [...redirects.quetre.i2p], - quetreI2pCustomRedirects: [], - - quetreLokiRedirectsChecks: [...redirects.quetre.loki], - quetreLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + quetreNormalRedirectsChecks = [...redirects.quetre.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = quetreNormalRedirectsChecks.indexOf(instance) + if (a > -1) quetreNormalRedirectsChecks.splice(a, 1) + } + browser.storage.local.set( + { + disableQuora: false, + + quoraRedirects: redirects, + + quetreNormalRedirectsChecks, + quetreNormalCustomRedirects: [], + + quetreTorRedirectsChecks: [...redirects.quetre.tor], + quetreTorCustomRedirects: [], + + quetreI2pRedirectsChecks: [...redirects.quetre.i2p], + quetreI2pCustomRedirects: [], + + quetreLokiRedirectsChecks: [...redirects.quetre.loki], + quetreLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/reddit.js b/src/assets/javascripts/reddit.js index 0d324e9e..ca1993b5 100644 --- a/src/assets/javascripts/reddit.js +++ b/src/assets/javascripts/reddit.js @@ -36,7 +36,7 @@ function setRedirects(val) { tedditNormalRedirectsChecks, tedditTorRedirectsChecks: [...redirects.teddit.tor], tedditI2pRedirectsChecks: [...redirects.teddit.i2p], - tedditLokiRedirectsChecks: [...redirects.teddit.loki] + tedditLokiRedirectsChecks: [...redirects.teddit.loki], }) }) } @@ -336,16 +336,16 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - libredditNormalRedirectsChecks = [...redirects.libreddit.normal] - tedditNormalRedirectsChecks = [...redirects.teddit.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = libredditNormalRedirectsChecks.indexOf(instance) - if (a > -1) libredditNormalRedirectsChecks.splice(a, 1) - - const b = tedditNormalRedirectsChecks.indexOf(instance) - if (b > -1) tedditNormalRedirectsChecks.splice(b, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + libredditNormalRedirectsChecks = [...redirects.libreddit.normal] + tedditNormalRedirectsChecks = [...redirects.teddit.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = libredditNormalRedirectsChecks.indexOf(instance) + if (a > -1) libredditNormalRedirectsChecks.splice(a, 1) + + const b = tedditNormalRedirectsChecks.indexOf(instance) + if (b > -1) tedditNormalRedirectsChecks.splice(b, 1) + } browser.storage.local.set( { disableReddit: false, diff --git a/src/assets/javascripts/reuters.js b/src/assets/javascripts/reuters.js index d1a0710b..51d16329 100644 --- a/src/assets/javascripts/reuters.js +++ b/src/assets/javascripts/reuters.js @@ -29,7 +29,7 @@ function setRedirects(val) { neutersNormalRedirectsChecks, neutersTorRedirectsChecks: [...redirects.neuters.tor], neutersI2pRedirectsChecks: [...redirects.neuters.i2p], - neutersLokiRedirectsChecks: [...redirects.neuters.loki] + neutersLokiRedirectsChecks: [...redirects.neuters.loki], }) }) } @@ -112,33 +112,33 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - neutersNormalRedirectsChecks = [...redirects.neuters.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = neutersNormalRedirectsChecks.indexOf(instance) - if (a > -1) neutersNormalRedirectsChecks.splice(a, 1) - } - browser.storage.local.set( - { - disableReuters: true, - - reutersRedirects: redirects, - - neutersNormalRedirectsChecks, - neutersNormalCustomRedirects: [], - - neutersTorRedirectsChecks: [...redirects.neuters.tor], - neutersTorCustomRedirects: [], - - neutersI2pRedirectsChecks: [...redirects.neuters.i2p], - neutersI2pCustomRedirects: [], - - neutersLokiRedirectsChecks: [...redirects.neuters.loki], - neutersLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + neutersNormalRedirectsChecks = [...redirects.neuters.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = neutersNormalRedirectsChecks.indexOf(instance) + if (a > -1) neutersNormalRedirectsChecks.splice(a, 1) + } + browser.storage.local.set( + { + disableReuters: true, + + reutersRedirects: redirects, + + neutersNormalRedirectsChecks, + neutersNormalCustomRedirects: [], + + neutersTorRedirectsChecks: [...redirects.neuters.tor], + neutersTorCustomRedirects: [], + + neutersI2pRedirectsChecks: [...redirects.neuters.i2p], + neutersI2pCustomRedirects: [], + + neutersLokiRedirectsChecks: [...redirects.neuters.loki], + neutersLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/search.js b/src/assets/javascripts/search.js index 7a137eaf..64b56caa 100644 --- a/src/assets/javascripts/search.js +++ b/src/assets/javascripts/search.js @@ -53,7 +53,7 @@ function setRedirects(val) { librexNormalRedirectsChecks, librexTorRedirectsChecks: [...redirects.librex.tor], librexI2pRedirectsChecks: [...redirects.librex.i2p], - librexLokiRedirectsChecks: [...redirects.librex.loki] + librexLokiRedirectsChecks: [...redirects.librex.loki], }) }) } @@ -485,24 +485,24 @@ function initDefaults() { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - searxNormalRedirectsChecks = [...redirects.searx.normal] - searxngNormalRedirectsChecks = [...redirects.searxng.normal] - whoogleNormalRedirectsChecks = [...redirects.whoogle.normal] - librexNormalRedirectsChecks = [...redirects.librex.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = searxNormalRedirectsChecks.indexOf(instance) - if (a > -1) searxNormalRedirectsChecks.splice(a, 1) + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + searxNormalRedirectsChecks = [...redirects.searx.normal] + searxngNormalRedirectsChecks = [...redirects.searxng.normal] + whoogleNormalRedirectsChecks = [...redirects.whoogle.normal] + librexNormalRedirectsChecks = [...redirects.librex.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = searxNormalRedirectsChecks.indexOf(instance) + if (a > -1) searxNormalRedirectsChecks.splice(a, 1) - const b = searxngNormalRedirectsChecks.indexOf(instance) - if (b > -1) searxngNormalRedirectsChecks.splice(b, 1) + const b = searxngNormalRedirectsChecks.indexOf(instance) + if (b > -1) searxngNormalRedirectsChecks.splice(b, 1) - const c = whoogleNormalRedirectsChecks.indexOf(instance) - if (c > -1) whoogleNormalRedirectsChecks.splice(c, 1) + const c = whoogleNormalRedirectsChecks.indexOf(instance) + if (c > -1) whoogleNormalRedirectsChecks.splice(c, 1) - const d = librexNormalRedirectsChecks.indexOf(instance) - if (d > -1) librexNormalRedirectsChecks.splice(d, 1) - } + const d = librexNormalRedirectsChecks.indexOf(instance) + if (d > -1) librexNormalRedirectsChecks.splice(d, 1) + } browser.storage.local.set( { disableSearch: false, diff --git a/src/assets/javascripts/sendTargets.js b/src/assets/javascripts/sendTargets.js index d17e969d..a52ab6ff 100644 --- a/src/assets/javascripts/sendTargets.js +++ b/src/assets/javascripts/sendTargets.js @@ -29,7 +29,7 @@ function setRedirects(val) { sendNormalRedirectsChecks, sendTorRedirectsChecks: [...redirects.send.tor], sendI2pRedirectsChecks: [...redirects.send.i2p], - sendLokiRedirectsChecks: [...redirects.send.loki] + sendLokiRedirectsChecks: [...redirects.send.loki], }) }) } @@ -157,12 +157,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - sendNormalRedirectsChecks = [...redirects.send.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = sendNormalRedirectsChecks.indexOf(instance) - if (a > -1) sendNormalRedirectsChecks.splice(a, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + sendNormalRedirectsChecks = [...redirects.send.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = sendNormalRedirectsChecks.indexOf(instance) + if (a > -1) sendNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableSendTarget: false, diff --git a/src/assets/javascripts/tiktok.js b/src/assets/javascripts/tiktok.js index 924aa81f..71f07687 100644 --- a/src/assets/javascripts/tiktok.js +++ b/src/assets/javascripts/tiktok.js @@ -29,7 +29,7 @@ function setRedirects(val) { proxiTokNormalRedirectsChecks, proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor], proxiTokI2pRedirectsChecks: [...redirects.proxiTok.i2p], - proxiTokLokiRedirectsChecks: [...redirects.proxiTok.loki] + proxiTokLokiRedirectsChecks: [...redirects.proxiTok.loki], }) }) } @@ -205,34 +205,33 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - proxiTokNormalRedirectsChecks = [...redirects.proxiTok.normal] - console.log(r) - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = proxiTokNormalRedirectsChecks.indexOf(instance) - if (a > -1) proxiTokNormalRedirectsChecks.splice(a, 1) - } - browser.storage.local.set( - { - disableTiktok: false, - - tiktokRedirects: redirects, - - proxiTokNormalRedirectsChecks, - proxiTokNormalCustomRedirects: [], - - proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor], - proxiTokTorCustomRedirects: [], - - proxiTokI2pRedirectsChecks: [...redirects.proxiTok.i2p], - proxiTokI2pCustomRedirects: [], - - proxiTokLokiRedirectsChecks: [...redirects.proxiTok.loki], - proxiTokLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + proxiTokNormalRedirectsChecks = [...redirects.proxiTok.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = proxiTokNormalRedirectsChecks.indexOf(instance) + if (a > -1) proxiTokNormalRedirectsChecks.splice(a, 1) + } + browser.storage.local.set( + { + disableTiktok: false, + + tiktokRedirects: redirects, + + proxiTokNormalRedirectsChecks, + proxiTokNormalCustomRedirects: [], + + proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor], + proxiTokTorCustomRedirects: [], + + proxiTokI2pRedirectsChecks: [...redirects.proxiTok.i2p], + proxiTokI2pCustomRedirects: [], + + proxiTokLokiRedirectsChecks: [...redirects.proxiTok.loki], + proxiTokLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/translate/translate.js b/src/assets/javascripts/translate/translate.js index 2e55c61b..993c630f 100644 --- a/src/assets/javascripts/translate/translate.js +++ b/src/assets/javascripts/translate/translate.js @@ -99,8 +99,8 @@ function setRedirects(val) { const a = simplyTranslateNormalCustomRedirects.indexOf(instance) if (a > -1) simplyTranslateNormalCustomRedirects.splice(a, 1) - const i = lingvaNormalRedirectsChecks.indexOf(instance) - if (i > -1) lingvaNormalRedirectsChecks.splice(i, 1) + const b = lingvaNormalRedirectsChecks.indexOf(instance) + if (b > -1) lingvaNormalRedirectsChecks.splice(b, 1) } browser.storage.local.set({ translateRedirects: redirects, @@ -111,7 +111,7 @@ function setRedirects(val) { lingvaNormalRedirectsChecks, lingvaTorRedirectsChecks: [...redirects.lingva.tor], lingvaI2pRedirectsChecks: [...redirects.lingva.i2p], - lingvaLokiRedirectsChecks: [...redirects.lingva.loki] + lingvaLokiRedirectsChecks: [...redirects.lingva.loki], }) }) } @@ -310,22 +310,21 @@ function initDefaults() { return new Promise(async resolve => { fetch("/instances/data.json") .then(response => response.text()) - .then(data => { + .then(async data => { let dataJson = JSON.parse(data) for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - simplyTranslateNormalCustomRedirects = [...redirects.simplyTranslate.normal] - lingvaNormalRedirectsChecks = [...redirects.lingva.normal] - console.log(r.offlineBlackList) - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = simplyTranslateNormalCustomRedirects.indexOf(instance) - if (a > -1) simplyTranslateNormalCustomRedirects.splice(a, 1) - - const b = lingvaNormalRedirectsChecks.indexOf(instance) - if (b > -1) lingvaNormalRedirectsChecks.splice(b, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + simplyTranslateNormalRedirectsChecks = [...redirects.simplyTranslate.normal] + lingvaNormalRedirectsChecks = [...redirects.lingva.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = simplyTranslateNormalRedirectsChecks.indexOf(instance) + if (a > -1) simplyTranslateNormalRedirectsChecks.splice(a, 1) + + const b = lingvaNormalRedirectsChecks.indexOf(instance) + if (b > -1) lingvaNormalRedirectsChecks.splice(b, 1) + } browser.storage.local.set( { translateDisable: false, diff --git a/src/assets/javascripts/twitter.js b/src/assets/javascripts/twitter.js index 8131fbc2..7111ad00 100644 --- a/src/assets/javascripts/twitter.js +++ b/src/assets/javascripts/twitter.js @@ -29,7 +29,7 @@ function setRedirects(val) { nitterNormalRedirectsChecks, nitterTorRedirectsChecks: [...redirects.nitter.tor], nitterI2pRedirectsChecks: [...redirects.nitter.i2p], - nitterLokiRedirectsChecks: [...redirects.nitter.loki] + nitterLokiRedirectsChecks: [...redirects.nitter.loki], }) }) } @@ -226,12 +226,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { - nitterNormalRedirectsChecks = [...redirects.nitter.normal] - for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { - let i = nitterNormalRedirectsChecks.indexOf(instance) - if (i > -1) nitterNormalRedirectsChecks.splice(i, 1) - } + browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => { + nitterNormalRedirectsChecks = [...redirects.nitter.normal] + for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) { + let i = nitterNormalRedirectsChecks.indexOf(instance) + if (i > -1) nitterNormalRedirectsChecks.splice(i, 1) + } browser.storage.local.set( { disableTwitter: false, @@ -253,7 +253,7 @@ function initDefaults() { () => resolve() ) }) -}) + }) }) } diff --git a/src/assets/javascripts/utils.js b/src/assets/javascripts/utils.js index c6cecc05..50ada765 100644 --- a/src/assets/javascripts/utils.js +++ b/src/assets/javascripts/utils.js @@ -62,7 +62,7 @@ function updateInstances() { invidious: instances.invidious, piped: instances.piped, pipedMaterial: instances.pipedMaterial, - cloudtube: instances.cloudtube + cloudtube: instances.cloudtube, }) twitterHelper.setRedirects(instances.nitter) instagramHelper.setRedirects(instances.bibliogram) diff --git a/src/assets/javascripts/wikipedia.js b/src/assets/javascripts/wikipedia.js index c72cb804..2d0f75a1 100644 --- a/src/assets/javascripts/wikipedia.js +++ b/src/assets/javascripts/wikipedia.js @@ -29,7 +29,7 @@ function setRedirects(val) { wikilessNormalRedirectsChecks, wikilessTorRedirectsChecks: [...redirects.wikiless.tor], wikilessI2pRedirectsChecks: [...redirects.wikiless.i2p], - wikilessLokiRedirectsChecks: [...redirects.wikiless.loki] + wikilessLokiRedirectsChecks: [...redirects.wikiless.loki], }) }) } @@ -203,12 +203,12 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - wikilessNormalRedirectsChecks = [...redirects.wikiless.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = wikilessNormalRedirectsChecks.indexOf(instance) - if (a > -1) wikilessNormalRedirectsChecks.splice(a, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + wikilessNormalRedirectsChecks = [...redirects.wikiless.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = wikilessNormalRedirectsChecks.indexOf(instance) + if (a > -1) wikilessNormalRedirectsChecks.splice(a, 1) + } browser.storage.local.set( { disableWikipedia: true, diff --git a/src/assets/javascripts/youtube/youtube.js b/src/assets/javascripts/youtube/youtube.js index b08ff909..32f06b9c 100644 --- a/src/assets/javascripts/youtube/youtube.js +++ b/src/assets/javascripts/youtube/youtube.js @@ -31,7 +31,7 @@ for (let i = 0; i < frontends.length; i++) { function setRedirects(val) { browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], r => { - redirects = val + redirects = val invidiousNormalRedirectsChecks = [...redirects.invidious.normal] pipedNormalRedirectsChecks = [...redirects.piped.normal] pipedMaterialNormalRedirectsChecks = [...redirects.pipedMaterial.normal] @@ -66,7 +66,7 @@ function setRedirects(val) { cloudtubeNormalRedirectsChecks, cloudtubeTorRedirectsChecks: [...redirects.cloudtube.tor], cloudtubeI2pRedirectsChecks: [...redirects.cloudtube.i2p], - cloudtubeLokiRedirectsChecks: [...redirects.cloudtube.loki] + cloudtubeLokiRedirectsChecks: [...redirects.cloudtube.loki], }) }) } diff --git a/src/assets/javascripts/youtubeMusic.js b/src/assets/javascripts/youtubeMusic.js index f0b44e1f..797da4d5 100644 --- a/src/assets/javascripts/youtubeMusic.js +++ b/src/assets/javascripts/youtubeMusic.js @@ -39,7 +39,7 @@ function setRedirects(val) { hyperpipeNormalRedirectsChecks, hyperpipeTorRedirectsChecks: [...redirects.hyperpipe.tor], hyperpipeI2pRedirectsChecks: [...redirects.hyperpipe.i2p], - hyperpipeLokiRedirectsChecks: [...redirects.hyperpipe.loki] + hyperpipeLokiRedirectsChecks: [...redirects.hyperpipe.loki], }) }) } @@ -272,16 +272,16 @@ function initDefaults() { for (let i = 0; i < frontends.length; i++) { redirects[frontends[i]] = dataJson[frontends[i]] } - browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { - beatbumpNormalRedirectsChecks = [...redirects.beatbump.normal] - hyperpipeNormalRedirectsChecks = [...redirects.hyperpipe.normal] - for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { - const a = beatbumpNormalRedirectsChecks.indexOf(instance) - if (a > -1) beatbumpNormalRedirectsChecks.splice(a, 1) - - const b = hyperpipeNormalRedirectsChecks.indexOf(instance) - if (b > -1) hyperpipeNormalRedirectsChecks.splice(b, 1) - } + browser.storage.local.get(["cloudflareBlackList", "offlineBlackList"], async r => { + beatbumpNormalRedirectsChecks = [...redirects.beatbump.normal] + hyperpipeNormalRedirectsChecks = [...redirects.hyperpipe.normal] + for (const instance of [...r.cloudflareBlackList, ...r.offlineBlackList]) { + const a = beatbumpNormalRedirectsChecks.indexOf(instance) + if (a > -1) beatbumpNormalRedirectsChecks.splice(a, 1) + + const b = hyperpipeNormalRedirectsChecks.indexOf(instance) + if (b > -1) hyperpipeNormalRedirectsChecks.splice(b, 1) + } browser.storage.local.set( { disableYoutubeMusic: false, -- cgit 1.4.1