2022-02-02 15:46:14 +01:00
|
|
|
import commonHelper from './common.js'
|
|
|
|
|
2022-01-31 19:01:16 +01:00
|
|
|
const targets = [
|
|
|
|
/https:\/\/google\.com/,
|
|
|
|
/https:\/\/.*\.google\.com/,
|
|
|
|
/https?:\/\/(((www|maps)\.)?(google\.).*(\/search)|search\.(google\.).*)/
|
2021-01-11 02:39:26 +01:00
|
|
|
];
|
2022-01-31 19:01:16 +01:00
|
|
|
const redirects = {
|
2022-02-01 19:37:43 +01:00
|
|
|
"searx": {
|
|
|
|
"normal": [
|
2022-01-31 19:01:16 +01:00
|
|
|
"https://a.searx.space",
|
|
|
|
"https://anon.sx",
|
|
|
|
"https://beezboo.com",
|
|
|
|
"https://darmarit.org",
|
|
|
|
"https://dynabyte.ca",
|
|
|
|
"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.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.feneas.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",
|
|
|
|
"https://trovu.komun.org",
|
|
|
|
"https://www.gruble.de",
|
|
|
|
"https://www.perfectpixel.de",
|
|
|
|
"https://www.searxs.eu",
|
|
|
|
"https://www.webrats.xyz",
|
|
|
|
"https://xeek.com",
|
|
|
|
"searx.roflcopter.fr"
|
|
|
|
],
|
2022-02-01 19:37:43 +01:00
|
|
|
"onion": [
|
|
|
|
"https://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
|
|
|
|
"https://searxbgetrkiwxhdwi6svpgh7eotopqyxhbqiokrwzg7dcte44t36kyd.onion",
|
|
|
|
"https://suche.xyzco456vwisukfg.onion",
|
|
|
|
"https://w5rl6wsd7mzj4bdkbuqvzidet5osdsm5jhg2f7nvfidakfq5exda5wid.onion",
|
|
|
|
"https://4n53nafyi77iplnbrpmxnp3x4exbswwxigujaxy3b37fvr7bvlopxeyd.onion",
|
|
|
|
"https://z34ambyi6makk6ta7ksog2sljly2ctt2sa3apekb7wkllk72sxecdtad.onion",
|
|
|
|
"https://search.4bkxscubgtxwvhpe.onion",
|
|
|
|
"https://juy4e6eicawzdrz7.onion",
|
|
|
|
"https://z5vawdol25vrmorm4yydmohsd4u6rdoj2sylvoi3e3nqvxkvpqul7bqd.onion",
|
|
|
|
"https://zbuc3bbzbfdqqo2x46repx2ddajbha6fpsjeeptjhhhhzji3zopxdqyd.onion",
|
|
|
|
"https://f4qfqajszpx5b7itzxt6mb7kj4ktpgbdq7lq6xaiqyqx6a7de3epptad.onion",
|
|
|
|
"https://searx.cwuzdtzlubq5uual.onion",
|
|
|
|
"https://rq2w52kyrif3xpfihkgjnhqm3a5aqhoikpv72z3drpjglfzc2wr5z4yd.onion",
|
|
|
|
"https://searx3aolosaf3urwnhpynlhuokqsgz47si4pzz5hvb7uuzyjncl2tid.onion",
|
|
|
|
"https://searx.bsbvtqi5oq2cqzn32zt4cr2f2z2rwots3dq7gmdcnlyqoxko2wx6reqd.onion",
|
|
|
|
],
|
|
|
|
"i2p": [
|
|
|
|
"https://ransack.i2p",
|
|
|
|
"https://mqamk4cfykdvhw5kjez2gnvse56gmnqxn7vkvvbuor4k4j2lbbnq.b32.i2p",
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"whoogle": {
|
|
|
|
"normal": [
|
2022-01-31 19:01:16 +01:00
|
|
|
"https://s.alefvanoon.xyz",
|
|
|
|
"https://search.albony.xyz",
|
|
|
|
"https://search.exonip.de",
|
|
|
|
"https://search.garudalinux.org",
|
|
|
|
"https://search.sethforprivacy.com",
|
|
|
|
"https://whoogle.fossho.st",
|
|
|
|
"https://whooglesearch.net",
|
|
|
|
"https://www.whooglesearch.ml",
|
|
|
|
"https://whoogle.dcs0.hu",
|
|
|
|
]
|
2022-02-01 19:37:43 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
let disableSearch;
|
|
|
|
const getDisableSearch = () => disableSearch;
|
|
|
|
function setDisableSearch(val) {
|
|
|
|
disableSearch = val;
|
|
|
|
browser.storage.sync.set({ disableSearch })
|
2022-02-02 15:46:14 +01:00
|
|
|
console.log("disableSearch: ", disableSearch)
|
2022-02-01 19:37:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
let searchInstance;
|
|
|
|
const getSearchInstance = () => searchInstance;
|
|
|
|
function setSearchInstance(val) {
|
|
|
|
searchInstance = val;
|
|
|
|
browser.storage.sync.set({ searchInstance })
|
2022-01-31 19:01:16 +01:00
|
|
|
};
|
2021-01-11 02:39:26 +01:00
|
|
|
|
2022-02-01 19:37:43 +01:00
|
|
|
let searchFrontend;
|
|
|
|
const getSearchFrontend = () => searchFrontend;
|
|
|
|
function setSearchFrontend(val) {
|
|
|
|
searchFrontend = val;
|
|
|
|
browser.storage.sync.set({ searchFrontend })
|
2022-02-02 15:46:14 +01:00
|
|
|
console.log("searchFrontend: ", searchFrontend)
|
2022-02-01 19:37:43 +01:00
|
|
|
};
|
|
|
|
|
2022-02-02 15:46:14 +01:00
|
|
|
async function redirect(url, initiator) {
|
|
|
|
await init();
|
|
|
|
if (disableSearch)
|
2022-02-01 19:37:43 +01:00
|
|
|
return null;
|
|
|
|
|
|
|
|
let instance;
|
|
|
|
let path;
|
|
|
|
if (searchFrontend == 'searx') {
|
2022-02-02 15:46:14 +01:00
|
|
|
instance = commonHelper.getRandomInstance(redirects.searx.normal);
|
2022-02-01 19:37:43 +01:00
|
|
|
path = "/"
|
|
|
|
}
|
|
|
|
if (searchFrontend == 'whoogle') {
|
2022-02-02 15:46:14 +01:00
|
|
|
instance = commonHelper.getRandomInstance(redirects.whoogle.normal);
|
2022-02-01 19:37:43 +01:00
|
|
|
path = "/search"
|
|
|
|
}
|
|
|
|
|
|
|
|
let searchQuery = "";
|
|
|
|
url.search.slice(1).split("&").forEach(function (input) {
|
|
|
|
if (input.startsWith("q=")) searchQuery = input;
|
|
|
|
});
|
2022-02-02 15:46:14 +01:00
|
|
|
console.log("Will return");
|
2022-02-01 19:37:43 +01:00
|
|
|
return `${instance}${path}?${searchQuery}`;
|
|
|
|
}
|
|
|
|
|
2022-02-02 15:46:14 +01:00
|
|
|
async function init() {
|
|
|
|
console.log("Init Search Helper");
|
|
|
|
let result = await browser.storage.sync.get([
|
|
|
|
"disableSearch",
|
|
|
|
"searchInstance",
|
|
|
|
"searchFrontend",
|
|
|
|
])
|
|
|
|
disableSearch = result.disableSearch;
|
|
|
|
searchInstance = result.searchInstance;
|
|
|
|
searchFrontend = result.searchFrontend;
|
|
|
|
}
|
|
|
|
|
2021-01-11 02:39:26 +01:00
|
|
|
export default {
|
|
|
|
targets,
|
|
|
|
redirects,
|
2022-02-01 19:37:43 +01:00
|
|
|
getDisableSearch,
|
|
|
|
setDisableSearch,
|
|
|
|
getSearchInstance,
|
|
|
|
setSearchInstance,
|
|
|
|
getSearchFrontend,
|
|
|
|
setSearchFrontend,
|
|
|
|
redirect,
|
2022-02-02 15:46:14 +01:00
|
|
|
init,
|
2021-01-11 02:39:26 +01:00
|
|
|
};
|