Added update instances to lingva. Fixed some bugs #16
This commit is contained in:
parent
93fce2d85a
commit
352c9127a6
|
@ -14,13 +14,27 @@ function getRandomInstance(instances) {
|
||||||
return instances[~~(instances.length * Math.random())];
|
return instances[~~(instances.length * Math.random())];
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateInstances() {
|
async function wholeInit() {
|
||||||
|
await youtubeHelper.init();
|
||||||
|
await twitterHelper.init();
|
||||||
|
await instagramHelper.init();
|
||||||
|
await redditHelper.init();
|
||||||
|
await translateHelper.init();
|
||||||
|
await searchHelper.init();
|
||||||
|
await wikipediaHelper.init();
|
||||||
|
await mediumHelper.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateInstances() {
|
||||||
const apiEndpoint = 'https://raw.githubusercontent.com/libredirect/instances/main/data.json';
|
const apiEndpoint = 'https://raw.githubusercontent.com/libredirect/instances/main/data.json';
|
||||||
let request = new XMLHttpRequest();
|
let request = new XMLHttpRequest();
|
||||||
request.open('GET', apiEndpoint, false);
|
request.open('GET', apiEndpoint, false);
|
||||||
request.send(null);
|
request.send(null);
|
||||||
|
|
||||||
if (request.status === 200) {
|
if (request.status === 200) {
|
||||||
|
|
||||||
|
await wholeInit();
|
||||||
|
|
||||||
const instances = JSON.parse(request.responseText);
|
const instances = JSON.parse(request.responseText);
|
||||||
|
|
||||||
youtubeHelper.setInvidiousRedirects(instances.invidious);
|
youtubeHelper.setInvidiousRedirects(instances.invidious);
|
||||||
|
@ -32,6 +46,7 @@ function updateInstances() {
|
||||||
redditHelper.setTedditRedirects(instances.teddit);
|
redditHelper.setTedditRedirects(instances.teddit);
|
||||||
|
|
||||||
translateHelper.setSimplyTranslateRedirects(instances.simplyTranslate);
|
translateHelper.setSimplyTranslateRedirects(instances.simplyTranslate);
|
||||||
|
translateHelper.setLingvaRedirects(instances.lingva)
|
||||||
|
|
||||||
searchHelper.setSearxRedirects(instances.searx);
|
searchHelper.setSearxRedirects(instances.searx);
|
||||||
searchHelper.setWhoogleRedirects(instances.whoogle);
|
searchHelper.setWhoogleRedirects(instances.whoogle);
|
||||||
|
|
|
@ -26,6 +26,12 @@ function setRedirects(val) {
|
||||||
redirects.bibliogram = val;
|
redirects.bibliogram = val;
|
||||||
browser.storage.sync.set({ instagramRedirects: redirects })
|
browser.storage.sync.set({ instagramRedirects: redirects })
|
||||||
console.log("instagramRedirects: ", val)
|
console.log("instagramRedirects: ", val)
|
||||||
|
for (const item of bibliogramRedirectsChecks)
|
||||||
|
if (!redirects.bibliogram.normal.includes(item)) {
|
||||||
|
var index = bibliogramRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) bibliogramRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setBibliogramRedirectsChecks(bibliogramRedirectsChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,12 @@ function setRedirects(val) {
|
||||||
redirects.scribe = val;
|
redirects.scribe = val;
|
||||||
browser.storage.sync.set({ mediumRedirects: redirects })
|
browser.storage.sync.set({ mediumRedirects: redirects })
|
||||||
console.log("mediumRedirects: ", val)
|
console.log("mediumRedirects: ", val)
|
||||||
|
for (const item of scribeRedirectsChecks)
|
||||||
|
if (!redirects.scribe.normal.includes(item)) {
|
||||||
|
var index = scribeRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) scribeRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setScribeRedirectsChecks(scribeRedirectsChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
let scribeRedirectsChecks;
|
let scribeRedirectsChecks;
|
||||||
|
|
|
@ -78,6 +78,12 @@ function setLibredditRedirectsChecks(val) {
|
||||||
libredditRedirectsChecks = val;
|
libredditRedirectsChecks = val;
|
||||||
browser.storage.sync.set({ libredditRedirectsChecks })
|
browser.storage.sync.set({ libredditRedirectsChecks })
|
||||||
console.log("libredditRedirectsChecks: ", val)
|
console.log("libredditRedirectsChecks: ", val)
|
||||||
|
for (const item of libredditRedirectsChecks)
|
||||||
|
if (!redirects.libreddit.normal.includes(item)) {
|
||||||
|
var index = libredditRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) libredditRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setLibredditRedirectsChecks(libredditRedirectsChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
let libredditCustomRedirects = [];
|
let libredditCustomRedirects = [];
|
||||||
|
@ -94,6 +100,12 @@ function setTedditRedirectsChecks(val) {
|
||||||
tedditRedirectsChecks = val;
|
tedditRedirectsChecks = val;
|
||||||
browser.storage.sync.set({ tedditRedirectsChecks })
|
browser.storage.sync.set({ tedditRedirectsChecks })
|
||||||
console.log("tedditRedirectsChecks: ", val)
|
console.log("tedditRedirectsChecks: ", val)
|
||||||
|
for (const item of tedditRedirectsChecks)
|
||||||
|
if (!redirects.teddit.normal.includes(item)) {
|
||||||
|
var index = tedditRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) tedditRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setTedditRedirectsChecks(tedditRedirectsChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
let tedditCustomRedirects = [];
|
let tedditCustomRedirects = [];
|
||||||
|
|
|
@ -14,106 +14,7 @@ let redirects = {
|
||||||
"https://darmarit.org/searx",
|
"https://darmarit.org/searx",
|
||||||
"https://dynabyte.ca",
|
"https://dynabyte.ca",
|
||||||
"https://engo.mint.lgbt",
|
"https://engo.mint.lgbt",
|
||||||
"https://jsearch.pw",
|
|
||||||
"https://metasearch.nl",
|
|
||||||
"https://nibblehole.com",
|
|
||||||
"https://northboot.xyz",
|
|
||||||
"https://paulgo.io",
|
|
||||||
"https://procurx.pt",
|
|
||||||
"https://putin.agency",
|
|
||||||
"https://quickso.eu.org",
|
|
||||||
"https://s.zhaocloud.net",
|
|
||||||
"https://search.076.ne.jp",
|
|
||||||
"https://search.activemail.de",
|
|
||||||
"https://search.anonymize.com",
|
|
||||||
"https://search.antonkling.se",
|
|
||||||
"https://search.asynchronousexchange.com",
|
|
||||||
"https://search.biboumail.fr",
|
|
||||||
"https://search.blou.xyz",
|
|
||||||
"https://search.bluelock.org",
|
|
||||||
"https://search.bus-hit.me",
|
|
||||||
"https://search.disroot.org",
|
|
||||||
"https://search.ethibox.fr",
|
|
||||||
"https://search.jigsaw-security.com",
|
|
||||||
"https://search.jpope.org",
|
|
||||||
"https://search.mdosch.de",
|
|
||||||
"https://search.neet.works",
|
|
||||||
"https://search.ononoki.org",
|
|
||||||
"https://search.snopyta.org",
|
|
||||||
"https://search.st8.at",
|
|
||||||
"https://search.stinpriza.org",
|
|
||||||
"https://search.trom.tf",
|
|
||||||
"https://search.zdechov.net",
|
|
||||||
"https://searx.bar",
|
|
||||||
"https://searx.be",
|
|
||||||
"https://searx.bissisoft.com",
|
|
||||||
"https://searx.divided-by-zero.eu",
|
|
||||||
"https://searx.dresden.network",
|
|
||||||
"https://searx.esmailelbob.xyz",
|
|
||||||
"https://searx.everdot.org",
|
|
||||||
"https://searx.fmac.xyz",
|
|
||||||
"https://searx.fossencdi.org",
|
|
||||||
"https://searx.gnous.eu",
|
|
||||||
"https://searx.gnu.style",
|
|
||||||
"https://searx.hardwired.link",
|
|
||||||
"https://searx.hummel-web.at",
|
|
||||||
"https://searx.lavatech.top",
|
|
||||||
"https://searx.mastodontech.de",
|
|
||||||
"https://searx.mha.fi",
|
|
||||||
"https://searx.mxchange.org",
|
|
||||||
"https://searx.nakhan.net",
|
|
||||||
"https://searx.netzspielplatz.de",
|
|
||||||
"https://searx.nevrlands.de",
|
|
||||||
"https://searx.ninja",
|
|
||||||
"https://searx.nixnet.services",
|
|
||||||
"https://searx.openhoofd.nl",
|
|
||||||
"https://searx.operationtulip.com",
|
|
||||||
"https://searx.org",
|
|
||||||
"https://searx.prvcy.eu",
|
|
||||||
"https://searx.pwoss.org",
|
|
||||||
"https://searx.rasp.fr",
|
|
||||||
"https://searx.roughs.ru",
|
|
||||||
"https://searx.ru",
|
|
||||||
"https://searx.run",
|
|
||||||
"https://searx.s1gm4.eu",
|
|
||||||
"https://searx.sadblog.xyz",
|
|
||||||
"https://searx.semipvt.com",
|
|
||||||
"https://searx.slash-dev.de",
|
|
||||||
"https://searx.solusar.de",
|
|
||||||
"https://searx.sp-codes.de",
|
|
||||||
"https://searx.stuehieyr.com",
|
|
||||||
"https://searx.sunless.cloud",
|
|
||||||
"https://searx.theanonymouse.xyz",
|
|
||||||
"https://searx.thegreenwebfoundation.org",
|
|
||||||
"https://searx.tiekoetter.com",
|
|
||||||
"https://searx.tk",
|
|
||||||
"https://searx.tux.land",
|
|
||||||
"https://searx.tuxcloud.net",
|
|
||||||
"https://searx.tyil.nl",
|
|
||||||
"https://searx.vitanetworks.link",
|
|
||||||
"https://searx.webheberg.info",
|
|
||||||
"https://searx.xkek.net",
|
|
||||||
"https://searx.xyz",
|
|
||||||
"https://searx.zackptg5.com",
|
|
||||||
"https://searx.zapashcanon.fr",
|
|
||||||
"https://searx.zecircle.xyz",
|
|
||||||
"https://searxzh.cn",
|
|
||||||
"https://seeks.hsbp.org",
|
|
||||||
"https://serx.cf",
|
|
||||||
"https://spot.ecloud.global",
|
|
||||||
"https://suche.dasnetzundich.de",
|
|
||||||
"https://suche.uferwerk.org",
|
|
||||||
"https://swag.pw",
|
|
||||||
"https://sx.catgirl.cloud",
|
|
||||||
"https://sx.fedi.tech",
|
|
||||||
"https://timdor.noip.me/searx",
|
|
||||||
"https://trovu.komun.org",
|
|
||||||
"https://www.gruble.de",
|
|
||||||
"https://www.perfectpixel.de/searx",
|
|
||||||
"https://www.searxs.eu",
|
|
||||||
"https://www.webrats.xyz",
|
|
||||||
"https://xeek.com",
|
|
||||||
"https://searx.roflcopter.fr"
|
|
||||||
],
|
],
|
||||||
"onion": [
|
"onion": [
|
||||||
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
|
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
|
||||||
|
@ -156,6 +57,15 @@ function setSearxRedirects(val) {
|
||||||
redirects.searx = val;
|
redirects.searx = val;
|
||||||
browser.storage.sync.set({ searchRedirects: redirects })
|
browser.storage.sync.set({ searchRedirects: redirects })
|
||||||
console.log("searxRedirects:", val)
|
console.log("searxRedirects:", val)
|
||||||
|
for (const item of searxRedirectsChecks) {
|
||||||
|
console.log(item)
|
||||||
|
if (!redirects.searx.normal.includes(item)) {
|
||||||
|
var index = searxRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) searxRedirectsChecks.splice(index, 1);
|
||||||
|
console.log(`Deleted ${item}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setSearxRedirectsChecks(searxRedirectsChecks);
|
||||||
}
|
}
|
||||||
let whoogleRedirectsChecks;
|
let whoogleRedirectsChecks;
|
||||||
const getWhoogleRedirectsChecks = () => whoogleRedirectsChecks;
|
const getWhoogleRedirectsChecks = () => whoogleRedirectsChecks;
|
||||||
|
@ -163,6 +73,12 @@ function setWhoogleRedirectsChecks(val) {
|
||||||
whoogleRedirectsChecks = val;
|
whoogleRedirectsChecks = val;
|
||||||
browser.storage.sync.set({ whoogleRedirectsChecks })
|
browser.storage.sync.set({ whoogleRedirectsChecks })
|
||||||
console.log("whoogleRedirectsChecks: ", val)
|
console.log("whoogleRedirectsChecks: ", val)
|
||||||
|
for (const item of whoogleRedirectsChecks)
|
||||||
|
if (!redirects.whoogle.normal.includes(item)) {
|
||||||
|
var index = whoogleRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) whoogleRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setWhoogleRedirectsChecks(whoogleRedirectsChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
let whoogleCustomRedirects = [];
|
let whoogleCustomRedirects = [];
|
||||||
|
@ -261,6 +177,8 @@ async function init() {
|
||||||
whoogleCustomRedirects = result.whoogleCustomRedirects ?? [];
|
whoogleCustomRedirects = result.whoogleCustomRedirects ?? [];
|
||||||
|
|
||||||
searxRedirectsChecks = result.searxRedirectsChecks ?? [...redirects.searx.normal];
|
searxRedirectsChecks = result.searxRedirectsChecks ?? [...redirects.searx.normal];
|
||||||
|
|
||||||
|
|
||||||
searxCustomRedirects = result.searxCustomRedirects ?? [];
|
searxCustomRedirects = result.searxCustomRedirects ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,12 @@ function setSimplyTranslateRedirects(val) {
|
||||||
redirects.simplyTranslate = val;
|
redirects.simplyTranslate = val;
|
||||||
browser.storage.sync.set({ translateRedirects: redirects })
|
browser.storage.sync.set({ translateRedirects: redirects })
|
||||||
console.log("simplyTranslateRedirects:", val)
|
console.log("simplyTranslateRedirects:", val)
|
||||||
|
for (const item of simplyTranslateRedirectsChecks)
|
||||||
|
if (!redirects.simplyTranslate.normal.includes(item)) {
|
||||||
|
var index = simplyTranslateRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) simplyTranslateRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setSimplyTranslateRedirectsChecks(simplyTranslateRedirectsChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
let simplyTranslateRedirectsChecks;
|
let simplyTranslateRedirectsChecks;
|
||||||
|
@ -65,6 +71,12 @@ function setLingvaRedirects(val) {
|
||||||
redirects.lingva = val;
|
redirects.lingva = val;
|
||||||
browser.storage.sync.set({ translateRedirects: redirects })
|
browser.storage.sync.set({ translateRedirects: redirects })
|
||||||
console.log("lingvaRedirects:", val)
|
console.log("lingvaRedirects:", val)
|
||||||
|
for (const item of lingvaRedirectsChecks)
|
||||||
|
if (!redirects.lingva.normal.includes(item)) {
|
||||||
|
var index = lingvaRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) lingvaRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setLingvaRedirectsChecks(lingvaRedirectsChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
let lingvaRedirectsChecks;
|
let lingvaRedirectsChecks;
|
||||||
|
|
|
@ -89,6 +89,12 @@ const getNitterRedirectsChecks = () => nitterRedirectsChecks;
|
||||||
function setNitterRedirectsChecks(val) {
|
function setNitterRedirectsChecks(val) {
|
||||||
nitterRedirectsChecks = val;
|
nitterRedirectsChecks = val;
|
||||||
browser.storage.sync.set({ nitterRedirectsChecks })
|
browser.storage.sync.set({ nitterRedirectsChecks })
|
||||||
|
for (const item of nitterRedirectsChecks)
|
||||||
|
if (!redirects.nitter.normal.includes(item)) {
|
||||||
|
var index = nitterRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) nitterRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setNitterRedirectsChecks(nitterRedirectsChecks);
|
||||||
console.log("nitterRedirectsChecks: ", val)
|
console.log("nitterRedirectsChecks: ", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,12 @@ function setRedirects(val) {
|
||||||
redirects.wikiless = val;
|
redirects.wikiless = val;
|
||||||
browser.storage.sync.set({ wikipediaRedirects: redirects })
|
browser.storage.sync.set({ wikipediaRedirects: redirects })
|
||||||
console.log("wikipediaRedirects: ", val)
|
console.log("wikipediaRedirects: ", val)
|
||||||
|
for (const item of wikilessRedirectsChecks)
|
||||||
|
if (!redirects.wikiless.normal.includes(item)) {
|
||||||
|
var index = wikilessRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) wikilessRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setWikilessRedirectsChecks(wikilessRedirectsChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
let disableWikipedia;
|
let disableWikipedia;
|
||||||
|
|
Loading…
Reference in New Issue