aboutsummaryrefslogtreecommitdiffstats
path: root/src/assets
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2022-02-10 00:04:00 +0300
committerManeraKai <manerakai@protonmail.com>2022-02-10 00:04:00 +0300
commit23ae536550334a359b1472a5afb2616815390c92 (patch)
tree6d7d3a30dc53d724e803d018c7cd5f855358f4c0 /src/assets
parentStricting targets #21 (diff)
downloadlibredirect-23ae536550334a359b1472a5afb2616815390c92.zip
Added ProxiTok #22
Diffstat (limited to 'src/assets')
-rw-r--r--src/assets/javascripts/helpers/search.js94
-rw-r--r--src/assets/javascripts/helpers/tiktok.js107
2 files changed, 196 insertions, 5 deletions
diff --git a/src/assets/javascripts/helpers/search.js b/src/assets/javascripts/helpers/search.js
index a51361eb..c48a0edb 100644
--- a/src/assets/javascripts/helpers/search.js
+++ b/src/assets/javascripts/helpers/search.js
@@ -1,18 +1,102 @@
import commonHelper from './common.js'
const targets = [
- /https?:\/\/(www\.|maps\.|search\.|)google\.com(\/search\?q=..*|\/$|)/,
+ /https?:\/\/(www\.|maps\.|search\.|)google\.com(\/search\?q=..*|\/$)/,
];
let redirects = {
"searx": {
"normal": [
- "https://a.searx.space",
"https://anon.sx",
- "https://beezboo.com",
"https://darmarit.org/searx",
"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://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",
],
"onion": [
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
@@ -145,7 +229,7 @@ function redirect(url, initiator) {
}
let searchQuery = "";
- url.search.slice(1).split("&").forEach(function (input) {
+ url.search.slice(1).split("&").forEach((input) => {
if (input.startsWith("q=")) searchQuery = input;
});
return `${randomInstance}${path}?${searchQuery}`;
diff --git a/src/assets/javascripts/helpers/tiktok.js b/src/assets/javascripts/helpers/tiktok.js
new file mode 100644
index 00000000..c2eb2fb6
--- /dev/null
+++ b/src/assets/javascripts/helpers/tiktok.js
@@ -0,0 +1,107 @@
+import commonHelper from './common.js'
+
+const targets = [
+ /^https?:\/\/(www\.|)tiktok\.com.*/
+];
+
+let redirects = {
+ "proxiTok": {
+ "normal": [
+ "https://proxitok.herokuapp.com",
+ ]
+ }
+}
+
+const getRedirects = () => redirects;
+function setRedirects(val) {
+ redirects.proxiTok = val;
+ browser.storage.sync.set({ tiktokRedirects: redirects })
+ console.log("tiktokRedirects: ", val)
+ for (const item of proxiTokRedirectsChecks)
+ if (!redirects.proxiTok.normal.includes(item)) {
+ var index = proxiTokRedirectsChecks.indexOf(item);
+ if (index !== -1) proxiTokRedirectsChecks.splice(index, 1);
+ }
+ setProxiTokRedirectsChecks(proxiTokRedirectsChecks);
+}
+
+let proxiTokRedirectsChecks;
+const getProxiTokRedirectsChecks = () => proxiTokRedirectsChecks;
+function setProxiTokRedirectsChecks(val) {
+ proxiTokRedirectsChecks = val;
+ browser.storage.sync.set({ proxiTokRedirectsChecks })
+ console.log("proxiTokRedirectsChecks: ", val)
+}
+
+let proxiTokCustomRedirects = [];
+const getProxiTokCustomRedirects = () => proxiTokCustomRedirects;
+function setProxiTokCustomRedirects(val) {
+ proxiTokCustomRedirects = val;
+ browser.storage.sync.set({ proxiTokCustomRedirects })
+ console.log("proxiTokCustomRedirects: ", val)
+}
+
+let disableTiktok;
+const getDisableTiktok = () => disableTiktok;
+function setDisableTiktok(val) {
+ disableTiktok = val;
+ browser.storage.sync.set({ disableTiktok })
+}
+
+function redirect(url, initiator, type) {
+ // https://www.tiktok.com/@keysikaspol/video/7061265241887345946
+ // https://www.tiktok.com/@keysikaspol
+
+ if (disableTiktok) return null;
+
+ if (type != "main_frame" && "sub_frame" && "xmlhttprequest") return null;
+
+ let instancesList = [...proxiTokRedirectsChecks, ...proxiTokCustomRedirects];
+ if (instancesList.length === 0) return null;
+ let randomInstance = commonHelper.getRandomInstance(instancesList)
+
+ if (initiator && (instancesList.includes(initiator.origin) || targets.includes(initiator.host))) return null;
+
+ let pathName = url.pathname.replace(new RegExp(/@.*\/(?=video)/), "")
+
+ return `${randomInstance}${pathName}`;
+}
+
+function isTiktok(url) {
+ return targets.some((rx) => rx.test(url.href));
+}
+
+async function init() {
+ let result = await browser.storage.sync.get([
+ "disableTiktok",
+ "tiktokRedirects",
+ "proxiTokRedirectsChecks",
+ "proxiTokCustomRedirects",
+ ])
+ disableTiktok = result.disableTiktok ?? false;
+ if (result.tiktokRedirects)
+ redirects = result.tiktokRedirects;
+
+ proxiTokRedirectsChecks = result.proxiTokRedirectsChecks ?? [...redirects.proxiTok.normal];
+ proxiTokCustomRedirects = result.proxiTokCustomRedirects ?? [];
+}
+
+export default {
+ targets,
+
+ getRedirects,
+ setRedirects,
+
+ getDisableTiktok,
+ setDisableTiktok,
+
+ getProxiTokRedirectsChecks,
+ setProxiTokRedirectsChecks,
+
+ getProxiTokCustomRedirects,
+ setProxiTokCustomRedirects,
+
+ redirect,
+ isTiktok,
+ init,
+};