diff --git a/src/assets/javascripts/helpers/common.js b/src/assets/javascripts/helpers/common.js index 5ff4797..52a4137 100644 --- a/src/assets/javascripts/helpers/common.js +++ b/src/assets/javascripts/helpers/common.js @@ -23,7 +23,7 @@ function updateInstances() { if (request.status === 200) { const instances = JSON.parse(request.responseText); - nameHelper.setInvidiousRedirects(instances.invidious); + youtubeHelper.setInvidiousRedirects(instances.invidious); twitterHelper.setRedirects(instances.nitter); @@ -140,6 +140,7 @@ function processDefaultCustomInstances( if (!nameCustomInstances.includes(val)) { nameCustomInstances.push(val) setNameCustomRedirects(nameCustomInstances); + nameCustomInstanceInput.value = ''; } calcNameCustomInstances(); } diff --git a/src/assets/javascripts/helpers/instagram.js b/src/assets/javascripts/helpers/instagram.js index fac1f53..e3255cc 100644 --- a/src/assets/javascripts/helpers/instagram.js +++ b/src/assets/javascripts/helpers/instagram.js @@ -7,25 +7,44 @@ const targets = [ "about.instagram.com", ]; let redirects = { - "normal": [ - "https://bibliogram.art", - "https://bibliogram.snopyta.org", - "https://bibliogram.pussthecat.org", - "https://bibliogram.1d4.us", - "https://insta.trom.tf", - "https://bib.riverside.rocks", - "https://bibliogram.esmailelbob.xyz", - "https://bib.actionsack.com", - "https://biblio.alefvanoon.xyz" - ] + "bibliogram": { + "normal": [ + "https://bibliogram.art", + "https://bibliogram.snopyta.org", + "https://bibliogram.pussthecat.org", + "https://bibliogram.1d4.us", + "https://insta.trom.tf", + "https://bib.riverside.rocks", + "https://bibliogram.esmailelbob.xyz", + "https://bib.actionsack.com", + "https://biblio.alefvanoon.xyz" + ] + } }; const getRedirects = () => redirects; function setRedirects(val) { - redirects = val; - browser.storage.sync.set({ instagramRedirects: val }) + redirects.bibliogram = val; + browser.storage.sync.set({ instagramRedirects: redirects }) console.log("instagramRedirects: ", val) } + +let bibliogramRedirectsChecks; +const getBibliogramRedirectsChecks = () => bibliogramRedirectsChecks; +function setBibliogramRedirectsChecks(val) { + bibliogramRedirectsChecks = val; + browser.storage.sync.set({ bibliogramRedirectsChecks }) + console.log("bibliogramRedirectsChecks: ", val) +} + +let bibliogramCustomRedirects = []; +const getBibliogramCustomRedirects = () => bibliogramCustomRedirects; +function setBibliogramCustomRedirects(val) { + bibliogramCustomRedirects = val; + browser.storage.sync.set({ bibliogramCustomRedirects }) + console.log("bibliogramCustomRedirects: ", val) +} + const reservedPaths = [ "about", "explore", @@ -61,22 +80,24 @@ function setDisableInstagram(val) { } function redirect(url, initiator, type) { - if (disableInstagram) - return null; + if (disableInstagram) return null; + + let instancesList = [...bibliogramRedirectsChecks, ...bibliogramCustomRedirects]; + if (instancesList.length === 0) return null; + let randomInstance = commonHelper.getRandomInstance(instancesList) // Do not redirect Bibliogram view on Instagram links - if (initiator && (redirects.normal.includes(initiator.origin) || targets.includes(initiator.host))) + if (initiator && (instancesList.includes(initiator.origin) || targets.includes(initiator.host))) return null; // Do not redirect /accounts, /embeds.js, or anything other than main_frame if (type !== "main_frame" || url.pathname.match(bypassPaths)) return 'CANCEL'; - let link = commonHelper.getRandomInstance(redirects.normal); if (url.pathname === "/" || instagramReservedPaths.includes(url.pathname.split("/")[1])) - return `${link}${url.pathname}${url.search}`; + return `${randomInstance}${url.pathname}${url.search}`; else - return `${link}/u${url.pathname}${url.search}`; // Likely a user profile, redirect to '/u/...' + return `${randomInstance}/u${url.pathname}${url.search}`; // Likely a user profile, redirect to '/u/...' } function isInstagram(url) { @@ -86,19 +107,34 @@ function isInstagram(url) { async function init() { let result = await browser.storage.sync.get([ "disableInstagram", - "instagramRedirects" + "instagramRedirects", + "bibliogramRedirectsChecks", + "bibliogramCustomRedirects", ]) disableInstagram = result.disableInstagram ?? false; if (result.instagramRedirects) redirects = result.instagramRedirects + + + bibliogramRedirectsChecks = result.bibliogramRedirectsChecks ?? [...redirects.bibliogram.normal]; + bibliogramCustomRedirects = result.bibliogramCustomRedirects ?? []; } export default { getRedirects, setRedirects, + getDisableInstagram, setDisableInstagram, + + getBibliogramRedirectsChecks, + setBibliogramRedirectsChecks, + + getBibliogramCustomRedirects, + setBibliogramCustomRedirects, + isInstagram, + redirect, init, }; diff --git a/src/assets/javascripts/helpers/medium.js b/src/assets/javascripts/helpers/medium.js index 16a6eac..d99eae1 100644 --- a/src/assets/javascripts/helpers/medium.js +++ b/src/assets/javascripts/helpers/medium.js @@ -17,20 +17,38 @@ const targets = [ ]; let redirects = { - "normal": [ - "https://scribe.rip", - "https://scribe.nixnet.services", - "https://scribe.citizen4.eu", - "https://scribe.bus-hit.me" - ] + "scribe": { + "normal": [ + "https://scribe.rip", + "https://scribe.nixnet.services", + "https://scribe.citizen4.eu", + "https://scribe.bus-hit.me" + ] + } }; const getRedirects = () => redirects; function setRedirects(val) { - redirects = val; - browser.storage.sync.set({ mediumRedirects: val }) + redirects.scribe = val; + browser.storage.sync.set({ mediumRedirects: redirects }) console.log("mediumRedirects: ", val) } +let scribeRedirectsChecks; +const getScribeRedirectsChecks = () => scribeRedirectsChecks; +function setScribeRedirectsChecks(val) { + scribeRedirectsChecks = val; + browser.storage.sync.set({ scribeRedirectsChecks }) + console.log("scribeRedirectsChecks: ", val) +} + +let scribeCustomRedirects = []; +const getScribeCustomRedirects = () => scribeCustomRedirects; +function setScribeCustomRedirects(val) { + scribeCustomRedirects = val; + browser.storage.sync.set({ scribeCustomRedirects }) + console.log("scribeCustomRedirects: ", val) +} + let disableMedium; const getDisableMedium = () => disableMedium; function setDisableMedium(val) { @@ -45,14 +63,19 @@ function redirect(url, initiator) { if (url.pathname == "/") return null; + + let instancesList = [...scribeRedirectsChecks, ...scribeCustomRedirects]; + if (instancesList.length === 0) return null; + let randomInstance = commonHelper.getRandomInstance(instancesList) + if ( commonHelper.isFirefox() && initiator && - (redirects.normal.includes(initiator.origin) || targets.includes(initiator.host)) + (instancesList.includes(initiator.origin) || targets.includes(initiator.host)) ) { browser.storage.sync.set({ redirectBypassFlag: true }); return null; } - return `${commonHelper.getRandomInstance(redirects.normal)}${url.pathname}${url.search}`; + return `${randomInstance}${url.pathname}${url.search}`; } function isMedium(url) { @@ -62,11 +85,16 @@ function isMedium(url) { async function init() { let result = await browser.storage.sync.get([ "disableMedium", - "mediumRedirects" + "mediumRedirects", + "scribeRedirectsChecks", + "scribeCustomRedirects", ]) disableMedium = result.disableMedium ?? false; if (result.mediumRedirects) redirects = result.mediumRedirects; + + scribeRedirectsChecks = result.scribeRedirectsChecks ?? [...redirects.scribe.normal]; + scribeCustomRedirects = result.scribeCustomRedirects ?? []; } export default { @@ -78,6 +106,12 @@ export default { getDisableMedium, setDisableMedium, + getScribeRedirectsChecks, + setScribeRedirectsChecks, + + getScribeCustomRedirects, + setScribeCustomRedirects, + redirect, isMedium, init, diff --git a/src/assets/javascripts/helpers/reddit.js b/src/assets/javascripts/helpers/reddit.js index ba3455d..fe7b0ec 100644 --- a/src/assets/javascripts/helpers/reddit.js +++ b/src/assets/javascripts/helpers/reddit.js @@ -71,6 +71,39 @@ function setTedditRedirects(val) { console.log("tedditRedirects:", val) } + +let libredditRedirectsChecks; +const getLibredditRedirectsChecks = () => libredditRedirectsChecks; +function setLibredditRedirectsChecks(val) { + libredditRedirectsChecks = val; + browser.storage.sync.set({ libredditRedirectsChecks }) + console.log("libredditRedirectsChecks: ", val) +} + +let libredditCustomRedirects = []; +const getLibredditCustomRedirects = () => libredditCustomRedirects; +function setLibredditCustomRedirects(val) { + libredditCustomRedirects = val; + browser.storage.sync.set({ libredditCustomRedirects }) + console.log("libredditCustomRedirects: ", val) +} + +let tedditRedirectsChecks; +const getTedditRedirectsChecks = () => tedditRedirectsChecks; +function setTedditRedirectsChecks(val) { + tedditRedirectsChecks = val; + browser.storage.sync.set({ tedditRedirectsChecks }) + console.log("tedditRedirectsChecks: ", val) +} + +let tedditCustomRedirects = []; +const getTedditCustomRedirects = () => tedditCustomRedirects; +function setTedditCustomRedirects(val) { + tedditCustomRedirects = val; + browser.storage.sync.set({ tedditCustomRedirects }) + console.log("tedditCustomRedirects: ", val) +} + const bypassPaths = /\/(gallery\/poll\/rpan\/settings\/topics)/; let disableReddit; @@ -101,8 +134,13 @@ function redirect(url, initiator, type) { if (type !== "main_frame" || url.pathname.match(bypassPaths)) return null; - let libredditLink = commonHelper.getRandomInstance(redirects.libreddit.normal); - let tedditLink = commonHelper.getRandomInstance(redirects.teddit.normal); + let libreddtInstancesList = [...libredditRedirectsChecks, ...libredditCustomRedirects]; + if (libreddtInstancesList.length === 0) return null; + let libredditRandomInstance = commonHelper.getRandomInstance(libreddtInstancesList); + + let tedditInstancesList = [...tedditRedirectsChecks, ...tedditCustomRedirects]; + if (tedditInstancesList.length === 0) return null; + let tedditRandomInstance = commonHelper.getRandomInstance(tedditInstancesList); if (url.host === "i.redd.it") // As of 2021-04-09, redirects for teddit images are nontrivial: @@ -110,9 +148,9 @@ function redirect(url, initiator, type) { // 404 error (probably needs fix on teddit project) // - some image links on teddit are very different // Therefore, don't support redirecting image links for teddit. - return `${libredditLink}/img${url.pathname}${url.search}`; + return `${libredditRandomInstance}/img${url.pathname}${url.search}`; else if (url.host === "redd.it") { - if (redditFrontend == 'libreddit') return `${libredditLink}${url.pathname}${url.search}`; + if (redditFrontend == 'libreddit') return `${libredditRandomInstance}${url.pathname}${url.search}`; if (redditFrontend == 'teddit' && !url.pathname.match(/^\/+[^\/]+\/+[^\/]/)) // As of 2021-04-22, redirects for teddit redd.it/foo links don't work. // It appears that adding "/comments" as a prefix works, so manually add @@ -121,10 +159,10 @@ function redirect(url, initiator, type) { // paths. // Note the difference between redd.it/comments/foo (doesn't work) and // teddit.net/comments/foo (works). - return `${tedditLink}/comments${url.pathname}${url.search}`; + return `${tedditRandomInstance}/comments${url.pathname}${url.search}`; } - if (redditFrontend == 'libreddit') return `${libredditLink}${url.pathname}${url.search}`; - if (redditFrontend == 'teddit') return `${tedditLink}${url.pathname}${url.search}`; + if (redditFrontend == 'libreddit') return `${libredditRandomInstance}${url.pathname}${url.search}`; + if (redditFrontend == 'teddit') return `${tedditRandomInstance}${url.pathname}${url.search}`; } function isReddit(url) { @@ -135,12 +173,22 @@ async function init() { let result = await browser.storage.sync.get([ "disableReddit", "redditFrontend", - "redditRedirects" + "redditRedirects", + "libredditRedirectsChecks", + "libredditCustomRedirects", + "tedditRedirectsChecks", + "tedditCustomRedirects", ]) disableReddit = result.disableReddit ?? false; redditFrontend = result.redditFrontend ?? 'libreddit'; if (result.redditRedirects) redirects = result.redditRedirects; + + libredditRedirectsChecks = result.libredditRedirectsChecks ?? [...redirects.libreddit.normal]; + libredditCustomRedirects = result.libredditCustomRedirects ?? []; + + tedditRedirectsChecks = result.tedditRedirectsChecks ?? [...redirects.teddit.normal]; + tedditCustomRedirects = result.tedditCustomRedirects ?? []; } export default { @@ -155,6 +203,18 @@ export default { getRedditFrontend, setRedditFrontend, + getLibredditRedirectsChecks, + setLibredditRedirectsChecks, + + getLibredditCustomRedirects, + setLibredditCustomRedirects, + + getTedditRedirectsChecks, + setTedditRedirectsChecks, + + getTedditCustomRedirects, + setTedditCustomRedirects, + redirect, isReddit, init, diff --git a/src/assets/javascripts/helpers/search.js b/src/assets/javascripts/helpers/search.js index 1130aa3..f8d8b4d 100644 --- a/src/assets/javascripts/helpers/search.js +++ b/src/assets/javascripts/helpers/search.js @@ -157,6 +157,37 @@ function setSearxRedirects(val) { browser.storage.sync.set({ searchRedirects: redirects }) console.log("searxRedirects:", val) } +let whoogleRedirectsChecks; +const getWhoogleRedirectsChecks = () => whoogleRedirectsChecks; +function setWhoogleRedirectsChecks(val) { + whoogleRedirectsChecks = val; + browser.storage.sync.set({ whoogleRedirectsChecks }) + console.log("whoogleRedirectsChecks: ", val) +} + +let whoogleCustomRedirects = []; +const getWhoogleCustomRedirects = () => whoogleCustomRedirects; +function setWhoogleCustomRedirects(val) { + whoogleCustomRedirects = val; + browser.storage.sync.set({ whoogleCustomRedirects }) + console.log("whoogleCustomRedirects: ", val) +} + +let searxRedirectsChecks; +const getSearxRedirectsChecks = () => searxRedirectsChecks; +function setSearxRedirectsChecks(val) { + searxRedirectsChecks = val; + browser.storage.sync.set({ searxRedirectsChecks }) + console.log("searxRedirectsChecks: ", val) +} + +let searxCustomRedirects = []; +const getSearxCustomRedirects = () => searxCustomRedirects; +function setSearxCustomRedirects(val) { + searxCustomRedirects = val; + browser.storage.sync.set({ searxCustomRedirects }) + console.log("searxCustomRedirects: ", val) +} function setWhoogleRedirects(val) { redirects.whoogle = val; @@ -184,14 +215,18 @@ function redirect(url, initiator) { if (disableSearch) return null; - let instance; + let randomInstance; let path; if (searchFrontend == 'searx') { - instance = commonHelper.getRandomInstance(redirects.searx.normal); + let instancesList = [...searxRedirectsChecks, ...searxCustomRedirects]; + if (instancesList.length === 0) return null; + randomInstance = commonHelper.getRandomInstance(instancesList) path = "/" } if (searchFrontend == 'whoogle') { - instance = commonHelper.getRandomInstance(redirects.whoogle.normal); + let instancesList = [...whoogleRedirectsChecks, ...whoogleCustomRedirects]; + if (instancesList.length === 0) return null; + randomInstance = commonHelper.getRandomInstance(instancesList) path = "/search" } @@ -199,7 +234,7 @@ function redirect(url, initiator) { url.search.slice(1).split("&").forEach(function (input) { if (input.startsWith("q=")) searchQuery = input; }); - return `${instance}${path}?${searchQuery}`; + return `${randomInstance}${path}?${searchQuery}`; } function isSearch(url) { @@ -211,11 +246,22 @@ async function init() { "disableSearch", "searchFrontend", "searchRedirects", + "whoogleRedirectsChecks", + "whoogleCustomRedirects", + "searxRedirectsChecks", + "searxCustomRedirects", ]) disableSearch = result.disableSearch ?? false; searchFrontend = result.searchFrontend ?? 'searx'; if (result.searchRedirects) redirects = result.searchRedirects; + + + whoogleRedirectsChecks = result.whoogleRedirectsChecks ?? [...redirects.whoogle.normal]; + whoogleCustomRedirects = result.whoogleCustomRedirects ?? []; + + searxRedirectsChecks = result.searxRedirectsChecks ?? [...redirects.whoogle.normal]; + searxCustomRedirects = result.searxCustomRedirects ?? []; } export default { @@ -232,6 +278,18 @@ export default { getSearchFrontend, setSearchFrontend, + getWhoogleRedirectsChecks, + setWhoogleRedirectsChecks, + + getWhoogleCustomRedirects, + setWhoogleCustomRedirects, + + getSearxRedirectsChecks, + setSearxRedirectsChecks, + + getSearxCustomRedirects, + setSearxCustomRedirects, + redirect, init, }; diff --git a/src/assets/javascripts/helpers/translate.js b/src/assets/javascripts/helpers/translate.js index c0f9599..5a765c9 100644 --- a/src/assets/javascripts/helpers/translate.js +++ b/src/assets/javascripts/helpers/translate.js @@ -44,12 +44,46 @@ function setSimplyTranslateRedirects(val) { console.log("simplyTranslateRedirects:", val) } +let simplyTranslateRedirectsChecks; +const getSimplyTranslateRedirectsChecks = () => simplyTranslateRedirectsChecks; +function setSimplyTranslateRedirectsChecks(val) { + simplyTranslateRedirectsChecks = val; + browser.storage.sync.set({ simplyTranslateRedirectsChecks }) + console.log("simplyTranslateRedirectsChecks: ", val) +} + +let simplyTranslateCustomRedirects = []; +const getSimplyTranslateCustomRedirects = () => simplyTranslateCustomRedirects; +function setSimplyTranslateCustomRedirects(val) { + simplyTranslateCustomRedirects = val; + browser.storage.sync.set({ simplyTranslateCustomRedirects }) + console.log("simplyTranslateCustomRedirects: ", val) +} + + function setLingvaRedirects(val) { redirects.lingva = val; browser.storage.sync.set({ translateRedirects: redirects }) console.log("lingvaRedirects:", val) } +let lingvaRedirectsChecks; +const getLingvaRedirectsChecks = () => lingvaRedirectsChecks; +function setLingvaRedirectsChecks(val) { + lingvaRedirectsChecks = val; + browser.storage.sync.set({ lingvaRedirectsChecks }) + console.log("lingvaRedirectsChecks: ", val) +} + +let lingvaCustomRedirects = []; +const getLingvaCustomRedirects = () => lingvaCustomRedirects; +function setLingvaCustomRedirects(val) { + lingvaCustomRedirects = val; + browser.storage.sync.set({ lingvaCustomRedirects }) + console.log("lingvaCustomRedirects: ", val) +} + + let disableTranslate; const getDisableTranslate = () => disableTranslate; function setDisableTranslate(val) { @@ -63,34 +97,39 @@ const getFrontend = () => translateFrontend; function setFrontend(val) { translateFrontend = val; browser.storage.sync.set({ translateFrontend }) - console.log("Translate frontend: ", frontend) + console.log("Translate frontend: ", val) } function redirect(url, initiator) { if (disableTranslate) { - console.log("SImplyTranslte disabled") + console.log("SimplyTranslate disabled") return null }; + + if (translateFrontend == 'simplyTranslate') { - let link; - if (translateFrontend == 'simplyTransalte') { - link = commonHelper.getRandomInstance(redirects.simplyTranslate.normal); - console.log(`${link}/${url.search}`); - return `${link}/${url.search}`; + let instancesList = [...simplyTranslateRedirectsChecks, ...simplyTranslateCustomRedirects]; + if (instancesList.length === 0) return null; + let randomInstance = commonHelper.getRandomInstance(instancesList) + + return `${randomInstance}/${url.search}`; } else if (translateFrontend == 'lingva') { let params_arr = url.search.split('&'); params_arr[0] = params_arr[0].substring(1); - let myMap = new Map(); + let myMap = {}; for (let i = 0; i < params_arr.length; i++) { let pair = params_arr[i].split('='); - myMap.set(pair[0], pair[1]); + myMap[pair[0]] = pair[1]; } - link = commonHelper.getRandomInstance(redirects.lingva.normal); - if (myMap.get("sl") && myMap.get("tl") && myMap.get("text")) - return `${link}/${myMap.get("sl")}/${myMap.get("tl")}/${myMap.get("text")}`; + let instancesList = [...lingvaRedirectsChecks, ...lingvaCustomRedirects]; + if (instancesList.length === 0) return null; + let randomInstance = commonHelper.getRandomInstance(instancesList) + + if (myMap.sl && myMap.tl && myMap.text) + return `${randomInstance}/${myMap.sl}/${myMap.tl}/${myMap.text}`; else - return link; + return randomInstance; } } @@ -103,12 +142,22 @@ async function init() { let result = await browser.storage.sync.get([ "disableTranslate", "translateFrontend", - "translateRedirects" + "translateRedirects", + "simplyTranslateRedirectsChecks", + "simplyTranslateCustomRedirects", + "lingvaRedirectsChecks", + "lingvaCustomRedirects", ]); disableTranslate = result.disableTranslate ?? false; - translateFrontend = result.translateFrontend ?? "simplyTransalte"; + translateFrontend = result.translateFrontend ?? "simplyTranslate"; if (result.translateRedirects) redirects = result.translateRedirects + + simplyTranslateRedirectsChecks = result.simplyTranslateRedirectsChecks ?? [...redirects.simplyTranslate.normal]; + simplyTranslateCustomRedirects = result.simplyTranslateCustomRedirects ?? []; + + lingvaRedirectsChecks = result.lingvaRedirectsChecks ?? [...redirects.lingva.normal]; + lingvaCustomRedirects = result.lingvaCustomRedirects ?? []; } export default { @@ -124,6 +173,18 @@ export default { getFrontend, setFrontend, + getSimplyTranslateRedirectsChecks, + setSimplyTranslateRedirectsChecks, + + getSimplyTranslateCustomRedirects, + setSimplyTranslateCustomRedirects, + + getLingvaRedirectsChecks, + setLingvaRedirectsChecks, + + getLingvaCustomRedirects, + setLingvaCustomRedirects, + redirect, init, }; diff --git a/src/assets/javascripts/helpers/twitter.js b/src/assets/javascripts/helpers/twitter.js index d97505c..7bf3ca1 100644 --- a/src/assets/javascripts/helpers/twitter.js +++ b/src/assets/javascripts/helpers/twitter.js @@ -14,74 +14,92 @@ const targets = [ ]; let redirects = { - "normal": [ - "https://nitter.net", - "https://nitter.42l.fr", - "https://nitter.pussthecat.org", - "https://nitter.nixnet.services", - "https://nitter.fdn.fr", - "https://nitter.1d4.us", - "https://nitter.kavin.rocks", - "https://nitter.unixfox.eu", - "https://nitter.domain.glass", - "https://nitter.eu", - "https://nitter.namazso.eu", - "https://nitter.actionsack.com", - "https://birdsite.xanny.family", - "https://nitter.hu", - "https://twitr.gq", - "https://nitter.moomoo.me", - "https://nittereu.moomoo.me", - "https://bird.trom.tf", - "https://nitter.it", - "https://twitter.censors.us", - "https://nitter.grimneko.de", - "https://nitter.alefvanoon.xyz", - "https://n.hyperborea.cloud", - "https://nitter.ca", - "https://twitter.076.ne.jp", - "https://nitter.mstdn.social", - "https://nitter.fly.dev", - "https://notabird.site", - "https://nitter.weiler.rocks", - "https://nitter.silkky.cloud", - "https://nitter.sethforprivacy.com", - "https://nttr.stream", - "https://nitter.cutelab.space", - "https://nitter.nl", - "https://nitter.mint.lgbt", - "https://nitter.tokhmi.xyz", - "https://nitter.bus-hit.me", - "https://fuckthesacklers.network", - "https://nitter.govt.land", - "https://nitter.datatunnel.xyz", - "https://nitter.esmailelbob.xyz" - ], - "onion": [ - "http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion", - "http://nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion", - "http://nitter7bryz3jv7e3uekphigvmoyoem4al3fynerxkj22dmoxoq553qd.onion", - "http://npf37k3mtzwxreiw52ccs5ay4e6qt2fkcs2ndieurdyn2cuzzsfyfvid.onion", - "http://nitter.v6vgyqpa7yefkorazmg5d5fimstmvm2vtbirt6676mt7qmllrcnwycqd.onion", - "http://i23nv6w3juvzlw32xzoxcqzktegd4i4fu3nmnc2ewv4ggiu4ledwklad.onion", - "http://26oq3gioiwcmfojub37nz5gzbkdiqp7fue5kvye7d4txv4ny6fb4wwid.onion", - "http://vfaomgh4jxphpbdfizkm5gbtjahmei234giqj4facbwhrfjtcldauqad.onion", - "http://iwgu3cv7ywf3gssed5iqtavmrlszgsxazkmwwnt4h2kdait75thdyrqd.onion", - "http://erpnncl5nhyji3c32dcfmztujtl3xaddqb457jsbkulq24zqq7ifdgad.onion", - "http://ckzuw5misyahmg7j5t5xwwuj3bwy62jfolxyux4brfflramzsvvd3syd.onion", - "http://jebqj47jgxleaiosfcxfibx2xdahjettuydlxbg64azd4khsxv6kawid.onion", - "http://nttr2iupbb6fazdpr2rgbooon2tzbbsvvkagkgkwohhodjzj43stxhad.onion", - "http://nitraeju2mipeziu2wtcrqsxg7h62v5y4eqgwi75uprynkj74gevvuqd.onion", - "http://nitter.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion" - ] + "nitter": { + "normal": [ + "https://nitter.net", + "https://nitter.42l.fr", + "https://nitter.pussthecat.org", + "https://nitter.nixnet.services", + "https://nitter.fdn.fr", + "https://nitter.1d4.us", + "https://nitter.kavin.rocks", + "https://nitter.unixfox.eu", + "https://nitter.domain.glass", + "https://nitter.eu", + "https://nitter.namazso.eu", + "https://nitter.actionsack.com", + "https://birdsite.xanny.family", + "https://nitter.hu", + "https://twitr.gq", + "https://nitter.moomoo.me", + "https://nittereu.moomoo.me", + "https://bird.trom.tf", + "https://nitter.it", + "https://twitter.censors.us", + "https://nitter.grimneko.de", + "https://nitter.alefvanoon.xyz", + "https://n.hyperborea.cloud", + "https://nitter.ca", + "https://twitter.076.ne.jp", + "https://nitter.mstdn.social", + "https://nitter.fly.dev", + "https://notabird.site", + "https://nitter.weiler.rocks", + "https://nitter.silkky.cloud", + "https://nitter.sethforprivacy.com", + "https://nttr.stream", + "https://nitter.cutelab.space", + "https://nitter.nl", + "https://nitter.mint.lgbt", + "https://nitter.tokhmi.xyz", + "https://nitter.bus-hit.me", + "https://fuckthesacklers.network", + "https://nitter.govt.land", + "https://nitter.datatunnel.xyz", + "https://nitter.esmailelbob.xyz" + ], + "onion": [ + "http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion", + "http://nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion", + "http://nitter7bryz3jv7e3uekphigvmoyoem4al3fynerxkj22dmoxoq553qd.onion", + "http://npf37k3mtzwxreiw52ccs5ay4e6qt2fkcs2ndieurdyn2cuzzsfyfvid.onion", + "http://nitter.v6vgyqpa7yefkorazmg5d5fimstmvm2vtbirt6676mt7qmllrcnwycqd.onion", + "http://i23nv6w3juvzlw32xzoxcqzktegd4i4fu3nmnc2ewv4ggiu4ledwklad.onion", + "http://26oq3gioiwcmfojub37nz5gzbkdiqp7fue5kvye7d4txv4ny6fb4wwid.onion", + "http://vfaomgh4jxphpbdfizkm5gbtjahmei234giqj4facbwhrfjtcldauqad.onion", + "http://iwgu3cv7ywf3gssed5iqtavmrlszgsxazkmwwnt4h2kdait75thdyrqd.onion", + "http://erpnncl5nhyji3c32dcfmztujtl3xaddqb457jsbkulq24zqq7ifdgad.onion", + "http://ckzuw5misyahmg7j5t5xwwuj3bwy62jfolxyux4brfflramzsvvd3syd.onion", + "http://jebqj47jgxleaiosfcxfibx2xdahjettuydlxbg64azd4khsxv6kawid.onion", + "http://nttr2iupbb6fazdpr2rgbooon2tzbbsvvkagkgkwohhodjzj43stxhad.onion", + "http://nitraeju2mipeziu2wtcrqsxg7h62v5y4eqgwi75uprynkj74gevvuqd.onion", + "http://nitter.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion" + ] + } }; const getRedirects = () => redirects; function setRedirects(val) { - redirects = val; - browser.storage.sync.set({ twitterRedirects: val }) + redirects.nitter = val; + browser.storage.sync.set({ twitterRedirects: redirects }) console.log("twitterRedirects:", val) } +let nitterRedirectsChecks; +const getNitterRedirectsChecks = () => nitterRedirectsChecks; +function setNitterRedirectsChecks(val) { + nitterRedirectsChecks = val; + browser.storage.sync.set({ nitterRedirectsChecks }) + console.log("nitterRedirectsChecks: ", val) +} + +let nitterCustomRedirects = []; +const getNitterCustomRedirects = () => nitterCustomRedirects; +function setNitterCustomRedirects(val) { + nitterCustomRedirects = val; + browser.storage.sync.set({ nitterCustomRedirects }) + console.log("nitterCustomRedirects: ", val) +} + let disableTwitter; const getDisableTwitter = () => disableTwitter; function setDisableTwitter(val) { @@ -97,23 +115,27 @@ function redirect(url, initiator) { if (url.pathname.split("/").includes("home")) { return null; } + + let instancesList = [...nitterRedirectsChecks, ...nitterCustomRedirects]; + if (instancesList.length === 0) return null; + let randomInstance = commonHelper.getRandomInstance(instancesList) + if ( commonHelper.isFirefox() && initiator && - (redirects.normal.includes(initiator.origin) || targets.includes(initiator.host)) + (instancesList.includes(initiator.origin) || targets.includes(initiator.host)) ) { browser.storage.sync.set({ redirectBypassFlag: true }); return null; } - let link = commonHelper.getRandomInstance(redirects.normal) if (url.host.split(".")[0] === "pbs" || url.host.split(".")[0] === "video") - return `${link}/pic/${encodeURIComponent(url.href)}`; + return `${randomInstance}/pic/${encodeURIComponent(url.href)}`; else if (url.pathname.split("/").includes("tweets")) - return `${link}${url.pathname.replace("/tweets", "")}${url.search}`; + return `${randomInstance}${url.pathname.replace("/tweets", "")}${url.search}`; else - return `${link}${url.pathname}${url.search}`; + return `${randomInstance}${url.pathname}${url.search}`; } @@ -124,11 +146,16 @@ function isTwitter(url) { async function init() { let result = await browser.storage.sync.get([ "disableTwitter", - "twitterRedirects" + "twitterRedirects", + "nitterRedirectsChecks", + "nitterCustomRedirects", ]); disableTwitter = result.disableTwitter ?? false; if (result.twitterRedirects) redirects = result.twitterRedirects; + + nitterRedirectsChecks = result.nitterRedirectsChecks ?? [...redirects.nitter.normal]; + nitterCustomRedirects = result.nitterCustomRedirects ?? []; } export default { @@ -138,6 +165,12 @@ export default { getDisableTwitter, setDisableTwitter, + getNitterRedirectsChecks, + setNitterRedirectsChecks, + + getNitterCustomRedirects, + setNitterCustomRedirects, + redirect, isTwitter, init, diff --git a/src/assets/javascripts/helpers/wikipedia.js b/src/assets/javascripts/helpers/wikipedia.js index 111eee2..8afecc7 100644 --- a/src/assets/javascripts/helpers/wikipedia.js +++ b/src/assets/javascripts/helpers/wikipedia.js @@ -3,20 +3,22 @@ import commonHelper from './common.js' const targets = /wikipedia.org/; let redirects = { - "normal": [ - "https://wikiless.org", - "https://wikiless.alefvanoon.xyz", - "https://wikiless.sethforprivacy.com", - "https://wiki.604kph.xyz" - ], - "onion": [ - "http://dj2tbh2nqfxyfmvq33cjmhuw7nb6am7thzd3zsjvizeqf374fixbrxyd.onion" - ] + "wikiless": { + "normal": [ + "https://wikiless.org", + "https://wikiless.alefvanoon.xyz", + "https://wikiless.sethforprivacy.com", + "https://wiki.604kph.xyz" + ], + "onion": [ + "http://dj2tbh2nqfxyfmvq33cjmhuw7nb6am7thzd3zsjvizeqf374fixbrxyd.onion" + ] + } }; const getRedirects = () => redirects; function setRedirects(val) { - redirects = val; - browser.storage.sync.set({ wikipediaRedirects: val }) + redirects.wikiless = val; + browser.storage.sync.set({ wikipediaRedirects: redirects }) console.log("wikipediaRedirects: ", val) } @@ -27,6 +29,23 @@ function setDisableWikipedia(val) { browser.storage.sync.set({ disableWikipedia }) } + +let wikilessRedirectsChecks; +const getWikilessRedirectsChecks = () => wikilessRedirectsChecks; +function setWikilessRedirectsChecks(val) { + wikilessRedirectsChecks = val; + browser.storage.sync.set({ wikilessRedirectsChecks }) + console.log("wikilessRedirectsChecks: ", val) +} + +let wikilessCustomRedirects = []; +const getWikilessCustomRedirects = () => wikilessCustomRedirects; +function setWikilessCustomRedirects(val) { + wikilessCustomRedirects = val; + browser.storage.sync.set({ wikilessCustomRedirects }) + console.log("wikilessCustomRedirects: ", val) +} + function redirect(url, initiator) { if (disableWikipedia) return null; @@ -39,8 +58,15 @@ function redirect(url, initiator) { GETArguments.push([args[0], args[1]]); } } - let instance = commonHelper.getRandomInstance(redirects.normal) - let link = `${instance}${url.pathname}`; + + let instancesList = [...wikilessRedirectsChecks, ...wikilessCustomRedirects]; + + if (instancesList.length === 0) + return null; + + let randomInstance = commonHelper.getRandomInstance(instancesList) + + let link = `${randomInstance}${url.pathname}`; let urlSplit = url.host.split("."); if (urlSplit[0] != "wikipedia" && urlSplit[0] != "www") { if (urlSplit[0] == "m") @@ -69,11 +95,16 @@ function isWikipedia(url) { async function init() { let result = await browser.storage.sync.get([ "disableWikipedia", - "wikipediaRedirects" + "wikipediaRedirects", + "wikilessRedirectsChecks", + "wikilessCustomRedirects", ]); disableWikipedia = result.disableWikipedia ?? false; if (result.wikipediaRedirects) redirects = result.wikipediaRedirects; + + wikilessRedirectsChecks = result.wikilessRedirectsChecks ?? [...redirects.wikiless.normal]; + wikilessCustomRedirects = result.wikilessCustomRedirects ?? []; } export default { @@ -83,6 +114,12 @@ export default { setDisableWikipedia, getDisableWikipedia, + getWikilessRedirectsChecks, + setWikilessRedirectsChecks, + + getWikilessCustomRedirects, + setWikilessCustomRedirects, + redirect, isWikipedia, init, diff --git a/src/pages/background/background.js b/src/pages/background/background.js index ca1f1f1..e4c0188 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -92,18 +92,25 @@ browser.tabs.onUpdated.addListener((tabId, changeInfo, _) => { mightyList.push( ...youtubeHelper.getRedirects().invidious.normal, ...youtubeHelper.getRedirects().piped.normal, - ...twitterHelper.getRedirects().normal, - ...instagramHelper.getRedirects().normal, + + ...twitterHelper.getRedirects().nitter.normal, + + ...instagramHelper.getRedirects().bibliogram.normal, + ...redditHelper.getRedirects().libreddit.normal, ...redditHelper.getRedirects().teddit.normal, redditHelper.getRedirects().desktop, redditHelper.getRedirects().mobile, + ...searchHelper.getRedirects().searx.normal, ...searchHelper.getRedirects().whoogle.normal, + ...translateHelper.getRedirects().simplyTranslate.normal, ...translateHelper.getRedirects().lingva.normal, - ...mediumHelper.getRedirects().normal, - ...wikipediaHelper.getRedirects().normal + + ...mediumHelper.getRedirects().scribe.normal, + + ...wikipediaHelper.getRedirects().wikiless.normal ); if (mightyList.includes(protocolHost)) browser.pageAction.show(tabId); diff --git a/src/pages/options/instagram/instagram.html b/src/pages/options/instagram/instagram.html index 98e296f..c7a5fbb 100644 --- a/src/pages/options/instagram/instagram.html +++ b/src/pages/options/instagram/instagram.html @@ -29,6 +29,30 @@ +
+ +
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ diff --git a/src/pages/options/instagram/instagram.js b/src/pages/options/instagram/instagram.js index c5aad9c..d911578 100644 --- a/src/pages/options/instagram/instagram.js +++ b/src/pages/options/instagram/instagram.js @@ -1,4 +1,5 @@ import instagramHelper from "../../../assets/javascripts/helpers/instagram.js"; +import commonHelper from "../../../assets/javascripts/helpers/common.js"; let disableInstagramElement = document.getElementById("disable-bibliogram"); disableInstagramElement.addEventListener("change", @@ -7,4 +8,14 @@ disableInstagramElement.addEventListener("change", instagramHelper.init().then(() => { disableInstagramElement.checked = !instagramHelper.getDisableInstagram(); + + commonHelper.processDefaultCustomInstances( + 'bibliogram', + instagramHelper, + document, + instagramHelper.getBibliogramRedirectsChecks, + instagramHelper.setBibliogramRedirectsChecks, + instagramHelper.getBibliogramCustomRedirects, + instagramHelper.setBibliogramCustomRedirects + ) }) \ No newline at end of file diff --git a/src/pages/options/medium/medium.html b/src/pages/options/medium/medium.html index 1c978d8..4f3f853 100644 --- a/src/pages/options/medium/medium.html +++ b/src/pages/options/medium/medium.html @@ -28,8 +28,33 @@

Enable

+ +
+ +
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ diff --git a/src/pages/options/medium/medium.js b/src/pages/options/medium/medium.js index fea6685..c86f190 100644 --- a/src/pages/options/medium/medium.js +++ b/src/pages/options/medium/medium.js @@ -1,4 +1,5 @@ import mediumHelper from "../../../assets/javascripts/helpers/medium.js"; +import commonHelper from "../../../assets/javascripts/helpers/common.js"; let disableMediumElement = document.getElementById("disable-scribe"); disableMediumElement.addEventListener("change", @@ -7,4 +8,14 @@ disableMediumElement.addEventListener("change", mediumHelper.init().then(() => { disableMediumElement.checked = !mediumHelper.getDisableMedium(); + + commonHelper.processDefaultCustomInstances( + 'scribe', + mediumHelper, + document, + mediumHelper.getScribeRedirectsChecks, + mediumHelper.setScribeRedirectsChecks, + mediumHelper.getScribeCustomRedirects, + mediumHelper.setScribeCustomRedirects + ) }) \ No newline at end of file diff --git a/src/pages/options/reddit/reddit.html b/src/pages/options/reddit/reddit.html index c968b95..2e89889 100644 --- a/src/pages/options/reddit/reddit.html +++ b/src/pages/options/reddit/reddit.html @@ -45,6 +45,58 @@ + +
+ +
+
+

Default Instances

+
+
+
+
+
+

Custom Instances

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

Default Instances

+
+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
diff --git a/src/pages/options/reddit/reddit.js b/src/pages/options/reddit/reddit.js index 92bd6e4..c2941df 100644 --- a/src/pages/options/reddit/reddit.js +++ b/src/pages/options/reddit/reddit.js @@ -1,16 +1,54 @@ import redditHelper from "../../../assets/javascripts/helpers/reddit.js"; +import commonHelper from "../../../assets/javascripts/helpers/common.js"; let disableRedditElement = document.getElementById("disable-reddit"); disableRedditElement.addEventListener("change", (event) => redditHelper.setDisableReddit(!event.target.checked) ); +let libredditDivElement = document.getElementById("libreddit") +let tedditDivElement = document.getElementById("teddit") + +function changeFrontendsSettings(frontend) { + if (frontend == 'libreddit') { + libredditDivElement.style.display = 'block'; + tedditDivElement.style.display = 'none'; + } + else if (frontend == 'teddit') { + libredditDivElement.style.display = 'none'; + tedditDivElement.style.display = 'block'; + } +} let redditFrontendElement = document.getElementById("reddit-frontend"); redditFrontendElement.addEventListener("change", - (event) => redditHelper.setRedditFrontend(event.target.options[redditFrontendElement.selectedIndex].value) + (event) => { + let frontend = event.target.options[redditFrontendElement.selectedIndex].value + redditHelper.setRedditFrontend(frontend) + changeFrontendsSettings(frontend); + } ); redditHelper.init().then(() => { disableRedditElement.checked = !redditHelper.getDisableReddit(); redditFrontendElement.value = redditHelper.getRedditFrontend(); + + commonHelper.processDefaultCustomInstances( + 'libreddit', + redditHelper, + document, + redditHelper.getLibredditRedirectsChecks, + redditHelper.setLibredditRedirectsChecks, + redditHelper.getLibredditCustomRedirects, + redditHelper.setLibredditCustomRedirects + ) + + commonHelper.processDefaultCustomInstances( + 'teddit', + redditHelper, + document, + redditHelper.getTedditRedirectsChecks, + redditHelper.setTedditRedirectsChecks, + redditHelper.getTedditCustomRedirects, + redditHelper.setTedditCustomRedirects + ) }) \ No newline at end of file diff --git a/src/pages/options/search/search.html b/src/pages/options/search/search.html index 489ed38..654292a 100644 --- a/src/pages/options/search/search.html +++ b/src/pages/options/search/search.html @@ -28,15 +28,6 @@

Enable

- -

Frontend

+
+ +
+
+

Default Instances

+
+
+
+
+
+

Custom Instances

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

Default Instances

+
+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
diff --git a/src/pages/options/search/search.js b/src/pages/options/search/search.js index e38480e..c50fbb1 100644 --- a/src/pages/options/search/search.js +++ b/src/pages/options/search/search.js @@ -1,16 +1,58 @@ import searchHelper from "../../../assets/javascripts/helpers/search.js"; - -let searchFrontendElement = document.getElementById("search-frontend"); -searchFrontendElement.addEventListener("change", - (event) => searchHelper.setSearchFrontend(event.target.options[searchFrontendElement.selectedIndex].value) -); +import commonHelper from "../../../assets/javascripts/helpers/common.js"; let disableSearchElement = document.getElementById("disable-search"); disableSearchElement.addEventListener("change", (event) => searchHelper.setDisableSearch(!event.target.checked) ); + +let searxDivElement = document.getElementById("searx") +let whoogleDivElement = document.getElementById("whoogle") + + +function changeFrontendsSettings(frontend) { + if (frontend == 'searx') { + searxDivElement.style.display = 'block'; + whoogleDivElement.style.display = 'none'; + } + else if (frontend == 'whoogle') { + searxDivElement.style.display = 'none'; + whoogleDivElement.style.display = 'block'; + } +} +let searchFrontendElement = document.getElementById("search-frontend"); +searchFrontendElement.addEventListener("change", + (event) => { + let frontend = event.target.options[searchFrontendElement.selectedIndex].value + searchHelper.setSearchFrontend(frontend) + changeFrontendsSettings(frontend); + } +); + searchHelper.init().then(() => { disableSearchElement.checked = !searchHelper.getDisableSearch(); - searchFrontendElement.value = searchHelper.getSearchFrontend(); + let frontend = searchHelper.getSearchFrontend(); + searchFrontendElement.value = frontend; + changeFrontendsSettings(frontend); + + commonHelper.processDefaultCustomInstances( + 'searx', + searchHelper, + document, + searchHelper.getSearxRedirectsChecks, + searchHelper.setSearxRedirectsChecks, + searchHelper.getSearxCustomRedirects, + searchHelper.setSearxCustomRedirects + ) + + commonHelper.processDefaultCustomInstances( + 'whoogle', + searchHelper, + document, + searchHelper.getWhoogleRedirectsChecks, + searchHelper.setWhoogleRedirectsChecks, + searchHelper.getWhoogleCustomRedirects, + searchHelper.setWhoogleCustomRedirects + ) }); diff --git a/src/pages/options/translate/translate.html b/src/pages/options/translate/translate.html index 7d4ba00..efc4305 100644 --- a/src/pages/options/translate/translate.html +++ b/src/pages/options/translate/translate.html @@ -27,20 +27,67 @@

Enable

-

Frontend

+ +
+ +
+
+

Default Instances

+
+
+
+
+
+

Custom Instances

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

Default Instances

+
+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+ diff --git a/src/pages/options/translate/translate.js b/src/pages/options/translate/translate.js index 480b754..a28d321 100644 --- a/src/pages/options/translate/translate.js +++ b/src/pages/options/translate/translate.js @@ -1,16 +1,58 @@ import translateHelper from "../../../assets/javascripts/helpers/translate.js"; +import commonHelper from "../../../assets/javascripts/helpers/common.js"; let disableTranslateElement = document.getElementById("disable-simplyTranslate"); disableTranslateElement.addEventListener("change", (event) => translateHelper.setDisableTranslate(!event.target.checked) ); + +let simplyTranslateDivElement = document.getElementById("simplyTranslate") +let lingvaDivElement = document.getElementById("lingva") + + +function changeFrontendsSettings(frontend) { + if (frontend == 'simplyTranslate') { + simplyTranslateDivElement.style.display = 'block'; + lingvaDivElement.style.display = 'none'; + } + else if (frontend == 'lingva') { + simplyTranslateDivElement.style.display = 'none'; + lingvaDivElement.style.display = 'block'; + } +} let translateFrontendElement = document.getElementById("translate-frontend"); translateFrontendElement.addEventListener("change", - (event) => translateHelper.setFrontend(event.target.options[translateFrontendElement.selectedIndex].value) + (event) => { + let frontend = event.target.options[translateFrontendElement.selectedIndex].value + translateHelper.setFrontend(frontend) + changeFrontendsSettings(frontend); + } ); translateHelper.init().then(() => { disableTranslateElement.checked = !translateHelper.getDisableTranslate(); - translateFrontendElement.value = translateHelper.getFrontend(); + let frontend = translateHelper.getFrontend(); + translateFrontendElement.value = frontend; + changeFrontendsSettings(frontend); + + commonHelper.processDefaultCustomInstances( + 'simplyTranslate', + translateHelper, + document, + translateHelper.getSimplyTranslateRedirectsChecks, + translateHelper.setSimplyTranslateRedirectsChecks, + translateHelper.getSimplyTranslateCustomRedirects, + translateHelper.setSimplyTranslateCustomRedirects + ) + + commonHelper.processDefaultCustomInstances( + 'lingva', + translateHelper, + document, + translateHelper.getLingvaRedirectsChecks, + translateHelper.setLingvaRedirectsChecks, + translateHelper.getLingvaCustomRedirects, + translateHelper.setLingvaCustomRedirects + ) }); \ No newline at end of file diff --git a/src/pages/options/twitter/twitter.html b/src/pages/options/twitter/twitter.html index 8e18985..bd0b37e 100644 --- a/src/pages/options/twitter/twitter.html +++ b/src/pages/options/twitter/twitter.html @@ -30,10 +30,30 @@

Enable

+ +
+
-

Proactively remove Twitter service worker

- +

Default Instances

+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
diff --git a/src/pages/options/twitter/twitter.js b/src/pages/options/twitter/twitter.js index 4316b45..e9c6464 100644 --- a/src/pages/options/twitter/twitter.js +++ b/src/pages/options/twitter/twitter.js @@ -1,4 +1,5 @@ import twitterHelper from "../../../assets/javascripts/helpers/twitter.js"; +import commonHelper from "../../../assets/javascripts/helpers/common.js"; let disableTwitterElement = document.getElementById("disable-nitter"); disableTwitterElement.addEventListener("change", @@ -7,4 +8,14 @@ disableTwitterElement.addEventListener("change", twitterHelper.init().then(() => { disableTwitterElement.checked = !twitterHelper.getDisableTwitter(); + + commonHelper.processDefaultCustomInstances( + 'nitter', + twitterHelper, + document, + twitterHelper.getNitterRedirectsChecks, + twitterHelper.setNitterRedirectsChecks, + twitterHelper.getNitterCustomRedirects, + twitterHelper.setNitterCustomRedirects + ) }); \ No newline at end of file diff --git a/src/pages/options/wikipedia/wikipedia.html b/src/pages/options/wikipedia/wikipedia.html index ed811e9..7298922 100644 --- a/src/pages/options/wikipedia/wikipedia.html +++ b/src/pages/options/wikipedia/wikipedia.html @@ -28,6 +28,32 @@

Enable

+ +
+ +
+

Default Instances

+
+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+ diff --git a/src/pages/options/wikipedia/wikipedia.js b/src/pages/options/wikipedia/wikipedia.js index 08a9a6e..8450714 100644 --- a/src/pages/options/wikipedia/wikipedia.js +++ b/src/pages/options/wikipedia/wikipedia.js @@ -1,10 +1,20 @@ import wikipediaHelper from "../../../assets/javascripts/helpers/wikipedia.js"; +import commonHelper from "../../../assets/javascripts/helpers/common.js"; let disableWikipediaElement = document.getElementById("disable-wikipedia"); disableWikipediaElement.addEventListener("change", (event) => wikipediaHelper.setDisableWikipedia(!event.target.checked) ); - wikipediaHelper.init().then(() => { disableWikipediaElement.checked = !wikipediaHelper.getDisableWikipedia(); + + commonHelper.processDefaultCustomInstances( + 'wikiless', + wikipediaHelper, + document, + wikipediaHelper.getWikilessRedirectsChecks, + wikipediaHelper.setWikilessRedirectsChecks, + wikipediaHelper.getWikilessCustomRedirects, + wikipediaHelper.setWikilessCustomRedirects + ) }) \ No newline at end of file diff --git a/src/pages/options/youtube/youtube.html b/src/pages/options/youtube/youtube.html index 8ecca39..bc0e8ef 100644 --- a/src/pages/options/youtube/youtube.html +++ b/src/pages/options/youtube/youtube.html @@ -146,7 +146,10 @@ +
+
+

Default Instances