Added Switch Instance to proxiTok & fixed instance fetching for it #326

This commit is contained in:
ManeraKai 2022-06-10 21:03:38 +03:00
parent e7555aa56e
commit fd844da5e0
5 changed files with 51 additions and 19 deletions

View File

@ -137,6 +137,32 @@ function reverse(url) {
})
}
function switchInstance(url) {
return new Promise(async resolve => {
await init();
let protocolHost = utils.protocolHost(url);
const all = [
...tiktokRedirects.proxiTok.tor,
...tiktokRedirects.proxiTok.normal,
...proxiTokNormalCustomRedirects,
...proxiTokTorCustomRedirects,
];
if (!all.includes(protocolHost)) { resolve(); return; }
let instancesList;
if (tiktokProtocol == 'normal') instancesList = [...proxiTokNormalCustomRedirects, ...proxiTokNormalRedirectsChecks];
else if (tiktokProtocol == 'tor') instancesList = [...proxiTokTorCustomRedirects, ...proxiTokTorRedirectsChecks];
const i = instancesList.indexOf(protocolHost);
if (i > -1) instancesList.splice(i, 1);
if (instancesList.length === 0) { resolve(); return; }
const randomInstance = utils.getRandomInstance(instancesList);
resolve(`${randomInstance}${url.pathname}${url.search}`);
})
}
function initDefaults() {
return new Promise(async resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => {
@ -163,6 +189,7 @@ export default {
redirect,
reverse,
switchInstance,
initProxiTokCookies,
pasteProxiTokCookies,

View File

@ -443,6 +443,7 @@ function switchInstance(test) {
if (!newUrl) newUrl = await searchHelper.switchInstance(url);
if (!newUrl) newUrl = await translateHelper.switchInstance(url);
if (!newUrl) newUrl = await mediumHelper.switchInstance(url);
if (!newUrl) newUrl = await tiktokHelper.switchInstance(url);
if (!newUrl) newUrl = await sendTargetsHelper.switchInstance(url);
if (!newUrl) newUrl = await peertubeHelper.switchInstance(url);
if (!newUrl) newUrl = await lbryHelper.switchInstance(url);

View File

@ -11,15 +11,15 @@
"https://tube.cthd.icu",
"https://yt.artemislena.eu",
"https://invidious.flokinet.to",
"https://invidious.tiekoetter.com",
"https://invidious.lunar.icu",
"https://invidious.sethforprivacy.com",
"https://invidious.projectsegfau.lt",
"https://inv.bp.projectsegfau.lt",
"https://invidious.weblibre.org",
"https://invidious.esmailelbob.xyz",
"https://youtube.076.ne.jp",
"https://inv.bp.projectsegfau.lt",
"https://invidious.namazso.eu",
"https://invidious.tiekoetter.com"
"https://invidious.projectsegfau.lt",
"https://invidious.namazso.eu"
],
"tor": [
"http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion",
@ -40,6 +40,7 @@
"https://piped.syncpundit.com",
"https://piped.mha.fi",
"https://piped.shimul.me",
"https://yt.jae.fi",
"https://piped.mint.lgbt",
"https://piped.privacy.com.de"
],
@ -50,7 +51,7 @@
"proxiTok": {
"normal": [
"https://proxitok.herokuapp.com",
"https://proxitok.pussthecat.org/",
"https://proxitok.pussthecat.org",
"https://proxitok.privacydev.net"
],
"tor": []
@ -131,7 +132,8 @@
"https://tweet.lambda.dance",
"https://nitter.ebnar.xyz",
"https://nitter.kylrth.com",
"https://nitter.oishi-ra.men"
"https://nitter.oishi-ra.men",
"https://nitter.foss.wtf"
],
"tor": [
"http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion",
@ -368,6 +370,7 @@
],
"normal": [
"https://anon.sx",
"https://asowneryt.cloudns.nz",
"https://dynabyte.ca",
"https://jsearch.pw",
"https://nibblehole.com",
@ -386,6 +389,7 @@
"https://searx.josie.lol",
"https://searx.kujonello.cf",
"https://searx.mastodontech.de",
"https://searx.mha.fi",
"https://searx.mxchange.org",
"https://searx.nakhan.net",
"https://searx.netzspielplatz.de",
@ -401,7 +405,6 @@
"https://searx.solusar.de",
"https://searx.sp-codes.de",
"https://searx.stuehieyr.com",
"https://searx.theanonymouse.xyz",
"https://searx.tux.land",
"https://searx.tuxcloud.net",
"https://searx.tyil.nl",
@ -431,7 +434,6 @@
],
"i2p": [],
"normal": [
"https://asowneryt.cloudns.nz",
"https://darmarit.org/searx",
"https://etsi.me",
"https://northboot.xyz",
@ -449,14 +451,12 @@
"https://search.vojkovic.xyz",
"https://search.zzls.xyz",
"https://searx.albony.xyz",
"https://searx.bardia.tech",
"https://searx.be",
"https://searx.ebnar.xyz",
"https://searx.esmailelbob.xyz",
"https://searx.fmac.xyz",
"https://searx.gnous.eu",
"https://searx.loafland.xyz",
"https://searx.mha.fi",
"https://searx.namejeff.xyz",
"https://searx.orion-hub.fr",
"https://searx.ppeb.me",
@ -464,6 +464,7 @@
"https://searx.prvcy.eu",
"https://searx.sev.monster",
"https://searx.tiekoetter.com",
"https://searxng.ir",
"https://searxng.zackptg5.com",
"https://serx.ml",
"https://swag.pw",
@ -500,19 +501,22 @@
"https://rimgo.lunar.icu",
"https://i.actionsack.com",
"https://rimgo.privacydev.net",
"https://imgur.artemislena.eu"
"https://imgur.artemislena.eu",
"https://rimgo.vern.cc"
],
"tor": [
"http://l4d4owboqr6xcmd6lf64gbegel62kbudu3x3jnldz2mx6mhn3bsv3zyd.onion",
"http://jx3dpcwedpzu2mh54obk5gvl64i2ln7pt5mrzd75s4jnndkqwzaim7ad.onion",
"http://rimgo.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion",
"http://be7udfhmnzqyt7cxysg6c4pbawarvaofjjywp35nhd5qamewdfxl6sid.onion"
"http://be7udfhmnzqyt7cxysg6c4pbawarvaofjjywp35nhd5qamewdfxl6sid.onion",
"http://rimgo.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion"
],
"i2p": [
"http://xazdnfgtzmcbcxhmcbbvr4uodd6jtn4fdiayasghywdn227xsmoa.b32.i2p"
]
},
"peertube": [
"https://watch.thelema.social",
"https://tube.miegl.cz",
"https://mov.clov.fr",
"https://videomensoif.ynh.fr",
@ -605,7 +609,6 @@
"https://peertube.frontmediatique.fr",
"https://peertube.bgzashtita.es",
"https://tube.genb.de",
"https://cosmoscine.org",
"https://cliptube.org",
"https://tube.tr4sk.me",
"https://videos.campdarling.com",
@ -629,7 +632,6 @@
"https://pt.k2s.sk",
"https://gameplay.wtf",
"https://video.cats-home.net",
"https://breeze.tube",
"https://peertube.narrativerry.xyz",
"https://tube.9minuti.it",
"https://krdtube.org",
@ -641,8 +643,6 @@
"https://peertube.hackerfraternity.org",
"https://openmedia.edunova.it",
"https://ocfedtest.hosted.spacebear.ee",
"https://video.thinkof.name",
"https://videos.alexandrebadalo.pt",
"https://video.lono.space",
"https://mirrored.rocks",
"https://videopen.net",
@ -1557,6 +1557,9 @@
"https://video.mantlepro.com",
"https://peertube.musicstudio.pro",
"https://peertube.we-keys.fr",
"https://artitube.artifaille.fr"
"https://artitube.artifaille.fr",
"https://peertube.fr",
"https://peertube.amicale.net",
"https://aperi.tube"
]
}

View File

@ -109,7 +109,7 @@ def proxitok():
proxiTokList['normal'] = []
proxiTokList['tor'] = []
for item in tmp:
proxiTokList['normal'].append(item)
proxiTokList['normal'].append(re.sub(r'/$', '', item))
mightyList['proxiTok'] = proxiTokList
print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'ProxiTok')
@ -383,7 +383,7 @@ for k1, v1 in mightyList.items():
for k2, v2 in mightyList[k1].items():
for instance in mightyList[k1][k2]:
if (not isValid(instance)):
mightyList[k1][k2].pop(instance)
mightyList[k1][k2].remove(instance)
print("removed " + instance)
else:
if not instance.endswith('.onion') and not instance.endswith('.i2p') and is_cloudflare(instance):

View File

@ -174,6 +174,7 @@ async function redirectOfflineInstance(url, tabId) {
if (!newUrl) newUrl = await searchHelper.switchInstance(url);
if (!newUrl) newUrl = await translateHelper.switchInstance(url);
if (!newUrl) newUrl = await mediumHelper.switchInstance(url);
if (!newUrl) newUrl = await tiktokHelper.switchInstance(url);
if (!newUrl) newUrl = await imgurHelper.switchInstance(url);
if (!newUrl) newUrl = await wikipediaHelper.switchInstance(url);
if (!newUrl) newUrl = await peertubeHelper.switchInstance(url);