Added ProxiTok #22
This commit is contained in:
parent
5d9a99f8e2
commit
23ae536550
@ -1,18 +1,102 @@
|
|||||||
import commonHelper from './common.js'
|
import commonHelper from './common.js'
|
||||||
|
|
||||||
const targets = [
|
const targets = [
|
||||||
/https?:\/\/(www\.|maps\.|search\.|)google\.com(\/search\?q=..*|\/$|)/,
|
/https?:\/\/(www\.|maps\.|search\.|)google\.com(\/search\?q=..*|\/$)/,
|
||||||
];
|
];
|
||||||
let redirects = {
|
let redirects = {
|
||||||
"searx": {
|
"searx": {
|
||||||
"normal": [
|
"normal": [
|
||||||
"https://a.searx.space",
|
|
||||||
"https://anon.sx",
|
"https://anon.sx",
|
||||||
"https://beezboo.com",
|
|
||||||
"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://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": [
|
"onion": [
|
||||||
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
|
"http://3afisqjw2rxm6z7mmstyt5rx75qfqrgxnkzftknbp2vhipr2nrmrjdyd.onion",
|
||||||
@ -145,7 +229,7 @@ function redirect(url, initiator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let searchQuery = "";
|
let searchQuery = "";
|
||||||
url.search.slice(1).split("&").forEach(function (input) {
|
url.search.slice(1).split("&").forEach((input) => {
|
||||||
if (input.startsWith("q=")) searchQuery = input;
|
if (input.startsWith("q=")) searchQuery = input;
|
||||||
});
|
});
|
||||||
return `${randomInstance}${path}?${searchQuery}`;
|
return `${randomInstance}${path}?${searchQuery}`;
|
||||||
|
107
src/assets/javascripts/helpers/tiktok.js
Normal file
107
src/assets/javascripts/helpers/tiktok.js
Normal file
@ -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,
|
||||||
|
};
|
@ -10,6 +10,7 @@ import mapsHelper from "../../assets/javascripts/helpers/maps.js";
|
|||||||
import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js";
|
import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js";
|
||||||
import mediumHelper from "../../assets/javascripts/helpers/medium.js";
|
import mediumHelper from "../../assets/javascripts/helpers/medium.js";
|
||||||
import imgurHelper from "../../assets/javascripts/helpers/imgur.js";
|
import imgurHelper from "../../assets/javascripts/helpers/imgur.js";
|
||||||
|
import tiktokHelper from "../../assets/javascripts/helpers/tiktok.js";
|
||||||
|
|
||||||
window.browser = window.browser || window.chrome;
|
window.browser = window.browser || window.chrome;
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ function wholeInit() {
|
|||||||
wikipediaHelper.init()
|
wikipediaHelper.init()
|
||||||
youtubeHelper.init()
|
youtubeHelper.init()
|
||||||
imgurHelper.init()
|
imgurHelper.init()
|
||||||
|
tiktokHelper.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
wholeInit();
|
wholeInit();
|
||||||
@ -55,6 +57,8 @@ browser.webRequest.onBeforeRequest.addListener(
|
|||||||
|
|
||||||
else if (imgurHelper.isImgur(url)) newUrl = imgurHelper.redirect(url, initiator, details.type);
|
else if (imgurHelper.isImgur(url)) newUrl = imgurHelper.redirect(url, initiator, details.type);
|
||||||
|
|
||||||
|
else if (tiktokHelper.isTiktok(url)) newUrl = tiktokHelper.redirect(url, initiator, details.type);
|
||||||
|
|
||||||
else if (translateHelper.isTranslate(url)) newUrl = translateHelper.redirect(url, initiator);
|
else if (translateHelper.isTranslate(url)) newUrl = translateHelper.redirect(url, initiator);
|
||||||
|
|
||||||
else if (searchHelper.isSearch(url)) newUrl = searchHelper.redirect(url, initiator)
|
else if (searchHelper.isSearch(url)) newUrl = searchHelper.redirect(url, initiator)
|
||||||
|
@ -54,6 +54,11 @@
|
|||||||
<input id="disable-imgur" type="checkbox" checked />
|
<input id="disable-imgur" type="checkbox" checked />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="some-block">
|
||||||
|
<h4>TikTok</h4>
|
||||||
|
<input id="disable-tiktok" type="checkbox" checked />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="some-block">
|
<div class="some-block">
|
||||||
<h4>Medium</h4>
|
<h4>Medium</h4>
|
||||||
<input id="disable-medium" type="checkbox" checked />
|
<input id="disable-medium" type="checkbox" checked />
|
||||||
|
@ -12,6 +12,7 @@ import translateHelper from "../../assets/javascripts/helpers/translate.js";
|
|||||||
import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js";
|
import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js";
|
||||||
import mediumHelper from "../../assets/javascripts/helpers/medium.js";
|
import mediumHelper from "../../assets/javascripts/helpers/medium.js";
|
||||||
import imgurHelper from "../../assets/javascripts/helpers/imgur.js";
|
import imgurHelper from "../../assets/javascripts/helpers/imgur.js";
|
||||||
|
import tiktokHelper from "../../assets/javascripts/helpers/tiktok.js";
|
||||||
|
|
||||||
let disableTwitterElement = document.querySelector("#disable-nitter");
|
let disableTwitterElement = document.querySelector("#disable-nitter");
|
||||||
let disableYoutubeElement = document.querySelector("#disable-invidious");
|
let disableYoutubeElement = document.querySelector("#disable-invidious");
|
||||||
@ -23,6 +24,7 @@ let disableTranslateElement = document.querySelector("#disable-simplyTranslate")
|
|||||||
let disableWikipediaElement = document.querySelector("#disable-wikipedia");
|
let disableWikipediaElement = document.querySelector("#disable-wikipedia");
|
||||||
let disableMediumElement = document.querySelector("#disable-medium");
|
let disableMediumElement = document.querySelector("#disable-medium");
|
||||||
let disableImgurElement = document.querySelector("#disable-imgur");
|
let disableImgurElement = document.querySelector("#disable-imgur");
|
||||||
|
let disableTiktokElement = document.querySelector("#disable-tiktok");
|
||||||
|
|
||||||
window.browser = window.browser || window.chrome;
|
window.browser = window.browser || window.chrome;
|
||||||
|
|
||||||
@ -36,6 +38,7 @@ async function wholeInit() {
|
|||||||
await translateHelper.init();
|
await translateHelper.init();
|
||||||
await wikipediaHelper.init();
|
await wikipediaHelper.init();
|
||||||
await imgurHelper.init();
|
await imgurHelper.init();
|
||||||
|
await tiktokHelper.init();
|
||||||
await mediumHelper.init();
|
await mediumHelper.init();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,6 +53,7 @@ wholeInit().then(() => {
|
|||||||
disableTranslateElement.checked = !translateHelper.getDisableTranslate();
|
disableTranslateElement.checked = !translateHelper.getDisableTranslate();
|
||||||
disableWikipediaElement.checked = !wikipediaHelper.getDisableWikipedia();
|
disableWikipediaElement.checked = !wikipediaHelper.getDisableWikipedia();
|
||||||
disableImgurElement.checked = !imgurHelper.getDisableImgur();
|
disableImgurElement.checked = !imgurHelper.getDisableImgur();
|
||||||
|
disableTiktokElement.checked = !tiktokHelper.getDisableTiktok();
|
||||||
disableMediumElement.checked = !mediumHelper.getDisableMedium();
|
disableMediumElement.checked = !mediumHelper.getDisableMedium();
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -89,6 +93,10 @@ disableImgurElement.addEventListener("change",
|
|||||||
(event) => imgurHelper.setDisableImgur(!event.target.checked)
|
(event) => imgurHelper.setDisableImgur(!event.target.checked)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
disableTiktokElement.addEventListener("change",
|
||||||
|
(event) => tiktokHelper.setDisableTiktok(!event.target.checked)
|
||||||
|
);
|
||||||
|
|
||||||
disableMediumElement.addEventListener("change",
|
disableMediumElement.addEventListener("change",
|
||||||
(event) => mediumHelper.setDisableMedium(!event.target.checked)
|
(event) => mediumHelper.setDisableMedium(!event.target.checked)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user