diff --git a/src/assets/javascripts/general.js b/src/assets/javascripts/general.js index 113dc6f..a8360bd 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 9b23528..5736855 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, + 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: [], + libremdbNormalRedirectsChecks, + libremdbNormalCustomRedirects: [], - libremdbTorRedirectsChecks: [...redirects.libremdb.tor], - libremdbTorCustomRedirects: [], + libremdbTorRedirectsChecks: [...redirects.libremdb.tor], + libremdbTorCustomRedirects: [], - libremdbI2pRedirectsChecks: [], - libremdbI2pCustomRedirects: [], + libremdbI2pRedirectsChecks: [], + libremdbI2pCustomRedirects: [], - libremdbLokiRedirectsChecks: [], - libremdbLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + libremdbLokiRedirectsChecks: [], + libremdbLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/imgur.js b/src/assets/javascripts/imgur.js index 6b94384..15b9cca 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 4908f5a..d0aa07c 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 6ca058e..5e285ad 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", + 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: [], + librarianNormalRedirectsChecks, + librarianNormalCustomRedirects: [], - librarianTorRedirectsChecks: [...redirects.librarian.tor], - librarianTorCustomRedirects: [], + librarianTorRedirectsChecks: [...redirects.librarian.tor], + librarianTorCustomRedirects: [], - librarianI2pRedirectsChecks: [...redirects.librarian.i2p], - librarianI2pCustomRedirects: [], + librarianI2pRedirectsChecks: [...redirects.librarian.i2p], + librarianI2pCustomRedirects: [], - librarianLokiRedirectsChecks: [...redirects.librarian.loki], - librarianLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + librarianLokiRedirectsChecks: [...redirects.librarian.loki], + librarianLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/maps.js b/src/assets/javascripts/maps.js index 79fd7a6..6e3c9af 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: [], + 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: [], + facilTorRedirectsChecks: [...redirects.facil.tor], + facilTorCustomRedirects: [], - facilI2pRedirectsChecks: [...redirects.facil.i2p], - facilI2pCustomRedirects: [], + facilI2pRedirectsChecks: [...redirects.facil.i2p], + facilI2pCustomRedirects: [], - facilLokiRedirectsChecks: [...redirects.facil.loki], - facilLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + facilLokiRedirectsChecks: [...redirects.facil.loki], + facilLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/medium.js b/src/assets/javascripts/medium.js index 2d63eb4..e5cb1dc 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 9819c01..478a18f 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 e241213..578cfe7 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, + 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, + quoraRedirects: redirects, - quetreNormalRedirectsChecks, - quetreNormalCustomRedirects: [], + quetreNormalRedirectsChecks, + quetreNormalCustomRedirects: [], - quetreTorRedirectsChecks: [...redirects.quetre.tor], - quetreTorCustomRedirects: [], + quetreTorRedirectsChecks: [...redirects.quetre.tor], + quetreTorCustomRedirects: [], - quetreI2pRedirectsChecks: [...redirects.quetre.i2p], - quetreI2pCustomRedirects: [], + quetreI2pRedirectsChecks: [...redirects.quetre.i2p], + quetreI2pCustomRedirects: [], - quetreLokiRedirectsChecks: [...redirects.quetre.loki], - quetreLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + quetreLokiRedirectsChecks: [...redirects.quetre.loki], + quetreLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/reddit.js b/src/assets/javascripts/reddit.js index 0d324e9..ca1993b 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) + 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) - } + 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 d1a0710..51d1632 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, + 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, + reutersRedirects: redirects, - neutersNormalRedirectsChecks, - neutersNormalCustomRedirects: [], + neutersNormalRedirectsChecks, + neutersNormalCustomRedirects: [], - neutersTorRedirectsChecks: [...redirects.neuters.tor], - neutersTorCustomRedirects: [], + neutersTorRedirectsChecks: [...redirects.neuters.tor], + neutersTorCustomRedirects: [], - neutersI2pRedirectsChecks: [...redirects.neuters.i2p], - neutersI2pCustomRedirects: [], + neutersI2pRedirectsChecks: [...redirects.neuters.i2p], + neutersI2pCustomRedirects: [], - neutersLokiRedirectsChecks: [...redirects.neuters.loki], - neutersLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + neutersLokiRedirectsChecks: [...redirects.neuters.loki], + neutersLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/search.js b/src/assets/javascripts/search.js index 7a137ea..64b56ca 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 d17e969..a52ab6f 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 924aa81..71f0768 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, + 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, + tiktokRedirects: redirects, - proxiTokNormalRedirectsChecks, - proxiTokNormalCustomRedirects: [], + proxiTokNormalRedirectsChecks, + proxiTokNormalCustomRedirects: [], - proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor], - proxiTokTorCustomRedirects: [], + proxiTokTorRedirectsChecks: [...redirects.proxiTok.tor], + proxiTokTorCustomRedirects: [], - proxiTokI2pRedirectsChecks: [...redirects.proxiTok.i2p], - proxiTokI2pCustomRedirects: [], + proxiTokI2pRedirectsChecks: [...redirects.proxiTok.i2p], + proxiTokI2pCustomRedirects: [], - proxiTokLokiRedirectsChecks: [...redirects.proxiTok.loki], - proxiTokLokiCustomRedirects: [], - }, - () => resolve() - ) - }) + proxiTokLokiRedirectsChecks: [...redirects.proxiTok.loki], + proxiTokLokiCustomRedirects: [], + }, + () => resolve() + ) + }) }) }) } diff --git a/src/assets/javascripts/translate/translate.js b/src/assets/javascripts/translate/translate.js index 2e55c61..993c630 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) + 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) - } + 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 8131fbc..7111ad0 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 c6cecc0..50ada76 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 c72cb80..2d0f75a 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 b08ff90..32f06b9 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 f0b44e1..797da4d 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) + 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) - } + const b = hyperpipeNormalRedirectsChecks.indexOf(instance) + if (b > -1) hyperpipeNormalRedirectsChecks.splice(b, 1) + } browser.storage.local.set( { disableYoutubeMusic: false,