2022-02-12 20:28:36 +01:00
|
|
|
window.browser = window.browser || window.chrome;
|
|
|
|
|
2022-02-02 15:46:14 +01:00
|
|
|
import commonHelper from './common.js'
|
|
|
|
|
2022-01-31 19:01:16 +01:00
|
|
|
const targets = [
|
2022-02-09 22:04:00 +01:00
|
|
|
/https?:\/\/(www\.|maps\.|search\.|)google\.com(\/search\?q=..*|\/$)/,
|
2021-01-11 02:39:26 +01:00
|
|
|
];
|
2022-02-03 11:41:23 +01:00
|
|
|
let redirects = {
|
2022-02-06 03:58:42 +01:00
|
|
|
"searx": {
|
2022-02-01 19:37:43 +01:00
|
|
|
"normal": [
|
2022-01-31 19:01:16 +01:00
|
|
|
"https://anon.sx",
|
2022-02-04 16:48:24 +01:00
|
|
|
"https://darmarit.org/searx",
|
2022-01-31 19:01:16 +01:00
|
|
|
"https://dynabyte.ca",
|
|
|
|
"https://engo.mint.lgbt",
|
2022-02-09 22:04:00 +01:00
|
|
|
"https://jsearch.pw",
|
|
|
|
"https://metasearch.nl",
|
|
|
|
"https://nibblehole.com",
|
|
|
|
"https://northboot.xyz",
|
|
|
|
"https://paulgo.io",
|
|
|
|
"https://procurx.pt",
|
|
|
|
"https://s.zhaocloud.net",
|
|
|
|
"https://search.antonkling.se",
|
|
|
|
"https://search.asynchronousexchange.com",
|
|
|
|
"https://search.biboumail.fr",
|
|
|
|
"https://search.bus-hit.me",
|
|
|
|
"https://search.disroot.org",
|
|
|
|
"https://search.ethibox.fr",
|
|
|
|
"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-private-search.de",
|
|
|
|
"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.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.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://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.webrats.xyz",
|
|
|
|
"https://xeek.com",
|
|
|
|
"https://searx.roflcopter.fr",
|
2022-01-31 19:01:16 +01:00
|
|
|
],
|
2022-02-19 22:48:51 +01:00
|
|
|
"tor": [
|
2022-02-04 16:48:24 +01:00
|
|
|
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
|
|
|
|
"http://searxbgetrkiwxhdwi6svpgh7eotopqyxhbqiokrwzg7dcte44t36kyd.onion",
|
|
|
|
"http://suche.xyzco456vwisukfg.onion",
|
|
|
|
"http://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion",
|
|
|
|
"http://4n53nafyi77iplnbrpmxnp3x4exbswwxigujaxy3b37fvr7bvlopxeyd.onion",
|
|
|
|
"http://z34ambyi6makk6ta7ksog2sljly2ctt2sa3apekb7wkllk72sxecdtad.onion",
|
|
|
|
"http://search.4bkxscubgtxwvhpe.onion",
|
|
|
|
"http://juy4e6eicawzdrz7.onion",
|
|
|
|
"http://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion",
|
|
|
|
"http://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion",
|
|
|
|
"http://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion",
|
|
|
|
"http://searx.cwuzdtzlubq5uual.onion",
|
|
|
|
"http://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion",
|
|
|
|
"http://searx3aolosaf3urwnhpynlhuokqsgz47si4pzz5hvb7uuzyjncl2tid.onion",
|
|
|
|
"http://searx.bsbvtqi5oq2cqzn32zt4cr2f2z2rwots3dq7gmdcnlyqoxko2wx6reqd.onion"
|
2022-02-01 19:37:43 +01:00
|
|
|
],
|
|
|
|
"i2p": [
|
2022-02-04 16:48:24 +01:00
|
|
|
"http://ransack.i2p",
|
|
|
|
"http://mqamk4cfykdvhw5kjez2gnvse56gmnqxn7vkvvbuor4k4j2lbbnq.b32.i2p"
|
2022-02-01 19:37:43 +01:00
|
|
|
]
|
|
|
|
},
|
2022-02-06 03:58:42 +01:00
|
|
|
"whoogle": {
|
2022-02-01 19:37:43 +01:00
|
|
|
"normal": [
|
2022-01-31 19:01:16 +01:00
|
|
|
"https://s.alefvanoon.xyz",
|
|
|
|
"https://search.albony.xyz",
|
|
|
|
"https://search.garudalinux.org",
|
|
|
|
"https://search.sethforprivacy.com",
|
|
|
|
"https://whoogle.fossho.st",
|
|
|
|
"https://whooglesearch.net",
|
|
|
|
"https://www.whooglesearch.ml",
|
2022-02-04 16:48:24 +01:00
|
|
|
"https://whoogle.dcs0.hu"
|
2022-01-31 19:01:16 +01:00
|
|
|
]
|
2022-02-04 16:48:24 +01:00
|
|
|
},
|
2022-02-01 19:37:43 +01:00
|
|
|
};
|
2022-02-04 00:13:37 +01:00
|
|
|
const getRedirects = () => redirects;
|
2022-02-16 16:54:13 +01:00
|
|
|
const getCustomRedirects = () => {
|
2022-02-12 10:30:30 +01:00
|
|
|
return {
|
|
|
|
"searx": {
|
|
|
|
"normal": [...searxRedirectsChecks, ...searxCustomRedirects]
|
|
|
|
},
|
|
|
|
"whoogle": {
|
|
|
|
"normal": [...whoogleRedirectsChecks, ...whoogleCustomRedirects]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
2022-02-04 00:13:37 +01:00
|
|
|
|
|
|
|
function setSearxRedirects(val) {
|
|
|
|
redirects.searx = val;
|
|
|
|
browser.storage.sync.set({ searchRedirects: redirects })
|
|
|
|
console.log("searxRedirects:", val)
|
2022-02-16 16:54:13 +01:00
|
|
|
for (const item of searxRedirectsChecks) if (!redirects.searx.normal.includes(item)) {
|
|
|
|
var index = searxRedirectsChecks.indexOf(item);
|
|
|
|
if (index !== -1) searxRedirectsChecks.splice(index, 1);
|
2022-02-08 16:28:25 +01:00
|
|
|
}
|
|
|
|
setSearxRedirectsChecks(searxRedirectsChecks);
|
2022-02-04 00:13:37 +01:00
|
|
|
}
|
2022-02-16 04:41:24 +01:00
|
|
|
|
|
|
|
function setWhoogleRedirects(val) {
|
|
|
|
redirects.whoogle = val;
|
|
|
|
browser.storage.sync.set({ searchRedirects: redirects })
|
|
|
|
console.log("whoogleRedirects:", val)
|
2022-02-16 16:54:13 +01:00
|
|
|
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);
|
2022-02-16 04:41:24 +01:00
|
|
|
}
|
|
|
|
|
2022-02-06 15:24:39 +01:00
|
|
|
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)
|
|
|
|
}
|
2022-02-04 00:13:37 +01:00
|
|
|
|
2022-02-16 04:41:24 +01:00
|
|
|
let disable;
|
|
|
|
const getDisable = () => disable;
|
|
|
|
function setDisable(val) {
|
|
|
|
disable = val;
|
|
|
|
browser.storage.sync.set({ disableSearch: disable })
|
|
|
|
console.log("disableSearch: ", disable)
|
2022-02-01 19:37:43 +01:00
|
|
|
}
|
|
|
|
|
2022-02-16 04:41:24 +01:00
|
|
|
let frontend;
|
|
|
|
const getFrontend = () => frontend;
|
|
|
|
function setFrontend(val) {
|
|
|
|
frontend = val;
|
|
|
|
browser.storage.sync.set({ searchFrontend: frontend })
|
|
|
|
console.log("searchFrontend: ", frontend)
|
2022-02-01 19:37:43 +01:00
|
|
|
};
|
|
|
|
|
2022-02-16 04:41:24 +01:00
|
|
|
function isSearch(url, initiator) {
|
|
|
|
if (disable) return false;
|
|
|
|
return targets.some((rx) => rx.test(url.href));
|
|
|
|
}
|
2022-02-01 19:37:43 +01:00
|
|
|
|
2022-02-16 04:41:24 +01:00
|
|
|
function redirect(url) {
|
2022-02-06 15:24:39 +01:00
|
|
|
let randomInstance;
|
2022-02-01 19:37:43 +01:00
|
|
|
let path;
|
2022-02-16 04:41:24 +01:00
|
|
|
if (frontend == 'searx') {
|
2022-02-06 15:24:39 +01:00
|
|
|
let instancesList = [...searxRedirectsChecks, ...searxCustomRedirects];
|
|
|
|
if (instancesList.length === 0) return null;
|
|
|
|
randomInstance = commonHelper.getRandomInstance(instancesList)
|
2022-02-16 04:41:24 +01:00
|
|
|
path = "/";
|
2022-02-01 19:37:43 +01:00
|
|
|
}
|
2022-02-16 04:41:24 +01:00
|
|
|
if (frontend == 'whoogle') {
|
2022-02-06 15:24:39 +01:00
|
|
|
let instancesList = [...whoogleRedirectsChecks, ...whoogleCustomRedirects];
|
|
|
|
if (instancesList.length === 0) return null;
|
|
|
|
randomInstance = commonHelper.getRandomInstance(instancesList)
|
2022-02-16 04:41:24 +01:00
|
|
|
path = "/search";
|
2022-02-01 19:37:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
let searchQuery = "";
|
2022-02-09 22:04:00 +01:00
|
|
|
url.search.slice(1).split("&").forEach((input) => {
|
2022-02-01 19:37:43 +01:00
|
|
|
if (input.startsWith("q=")) searchQuery = input;
|
|
|
|
});
|
2022-02-16 04:41:24 +01:00
|
|
|
|
2022-02-06 15:24:39 +01:00
|
|
|
return `${randomInstance}${path}?${searchQuery}`;
|
2022-02-01 19:37:43 +01:00
|
|
|
}
|
|
|
|
|
2022-02-02 15:46:14 +01:00
|
|
|
async function init() {
|
2022-02-12 20:28:36 +01:00
|
|
|
return new Promise((resolve) => {
|
|
|
|
browser.storage.sync.get(
|
|
|
|
[
|
|
|
|
"disableSearch",
|
|
|
|
"searchFrontend",
|
|
|
|
"searchRedirects",
|
|
|
|
"whoogleRedirectsChecks",
|
|
|
|
"whoogleCustomRedirects",
|
|
|
|
"searxRedirectsChecks",
|
|
|
|
"searxCustomRedirects",
|
|
|
|
],
|
|
|
|
(result) => {
|
2022-02-16 04:41:24 +01:00
|
|
|
disable = result.disableSearch ?? false;
|
2022-02-16 16:54:13 +01:00
|
|
|
|
2022-02-16 04:41:24 +01:00
|
|
|
frontend = result.searchFrontend ?? 'searx';
|
|
|
|
|
2022-02-12 20:28:36 +01:00
|
|
|
if (result.searchRedirects) redirects = result.searchRedirects;
|
2022-02-06 15:24:39 +01:00
|
|
|
|
2022-02-12 20:28:36 +01:00
|
|
|
whoogleRedirectsChecks = result.whoogleRedirectsChecks ?? [...redirects.whoogle.normal];
|
|
|
|
whoogleCustomRedirects = result.whoogleCustomRedirects ?? [];
|
2022-02-06 15:24:39 +01:00
|
|
|
|
2022-02-12 20:28:36 +01:00
|
|
|
searxRedirectsChecks = result.searxRedirectsChecks ?? [...redirects.searx.normal];
|
|
|
|
searxCustomRedirects = result.searxCustomRedirects ?? [];
|
2022-02-08 16:28:25 +01:00
|
|
|
|
2022-02-12 20:28:36 +01:00
|
|
|
resolve();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
2022-02-02 15:46:14 +01:00
|
|
|
}
|
|
|
|
|
2021-01-11 02:39:26 +01:00
|
|
|
export default {
|
2022-02-04 00:13:37 +01:00
|
|
|
isSearch,
|
|
|
|
|
2022-02-16 04:41:24 +01:00
|
|
|
getDisable,
|
|
|
|
setDisable,
|
|
|
|
|
2022-02-04 00:13:37 +01:00
|
|
|
getRedirects,
|
2022-02-12 10:30:30 +01:00
|
|
|
getCustomRedirects,
|
2022-02-04 00:13:37 +01:00
|
|
|
setSearxRedirects,
|
|
|
|
setWhoogleRedirects,
|
|
|
|
|
2022-02-16 04:41:24 +01:00
|
|
|
getFrontend,
|
|
|
|
setFrontend,
|
2022-02-04 00:13:37 +01:00
|
|
|
|
2022-02-06 15:24:39 +01:00
|
|
|
getWhoogleRedirectsChecks,
|
|
|
|
setWhoogleRedirectsChecks,
|
|
|
|
|
|
|
|
getWhoogleCustomRedirects,
|
|
|
|
setWhoogleCustomRedirects,
|
|
|
|
|
|
|
|
getSearxRedirectsChecks,
|
|
|
|
setSearxRedirectsChecks,
|
|
|
|
|
|
|
|
getSearxCustomRedirects,
|
|
|
|
setSearxCustomRedirects,
|
|
|
|
|
2022-02-01 19:37:43 +01:00
|
|
|
redirect,
|
2022-02-02 15:46:14 +01:00
|
|
|
init,
|
2021-01-11 02:39:26 +01:00
|
|
|
};
|