Clarifying authenticate instances #311

This commit is contained in:
ManeraKai 2022-06-04 19:42:34 +03:00
parent b6875ee886
commit fec9df153e
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
19 changed files with 142 additions and 94 deletions

View File

@ -21,7 +21,7 @@ function setRedirects() {
rimgoTorRedirectsChecks = [...redirects.rimgo.tor];
rimgoI2pRedirectsChecks = [...redirects.rimgo.i2p];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = rimgoNormalRedirectsChecks.indexOf(instance);
if (a > -1) rimgoNormalRedirectsChecks.splice(a, 1);
@ -156,9 +156,9 @@ function initDefaults() {
fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data);
redirects.rimgo = dataJson.rimgo;
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get('cloudflareBlackList', async r => {
rimgoNormalRedirectsChecks = [...redirects.rimgo.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const i = rimgoNormalRedirectsChecks.indexOf(instance);
if (i > -1) rimgoNormalRedirectsChecks.splice(i, 1);
}

View File

@ -12,10 +12,10 @@ let redirects = {
}
};
function setRedirects(val) {
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get('cloudflareBlackList', async r => {
redirects.bibliogram = val;
bibliogramNormalRedirectsChecks = [...redirects.bibliogram.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = bibliogramNormalRedirectsChecks.indexOf(instance);
if (a > -1) bibliogramNormalRedirectsChecks.splice(a, 1);
}
@ -133,9 +133,9 @@ function initDefaults() {
fetch('/instances/data.json').then(response => response.text()).then(data => {
let dataJson = JSON.parse(data);
redirects.bibliogram = dataJson.bibliogram;
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get('cloudflareBlackList', r => {
bibliogramNormalRedirectsChecks = [...redirects.bibliogram.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const i = bibliogramNormalRedirectsChecks.indexOf(instance);
if (i > -1) bibliogramNormalRedirectsChecks.splice(i, 1);
}

View File

@ -121,9 +121,9 @@ function redirect(url, type, initiator) {
function initDefaults() {
return new Promise(resolve => {
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get('cloudflareBlackList', async r => {
librarianNormalRedirectsChecks = [...redirects.librarian.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
let i;
i = librarianNormalRedirectsChecks.indexOf(instance);

View File

@ -35,10 +35,10 @@ let redirects = {
}
};
function setRedirects(val) {
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get('cloudflareBlackList', r => {
redirects.scribe = val;
scribeNormalRedirectsChecks = [...redirects.scribe.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = scribeNormalRedirectsChecks.indexOf(instance);
if (a > -1) scribeNormalRedirectsChecks.splice(a, 1);
}
@ -141,10 +141,10 @@ function initDefaults() {
fetch('/instances/data.json').then(response => response.text()).then(data => {
let dataJson = JSON.parse(data);
redirects.scribe = dataJson.scribe;
browser.storage.local.get('cloudflareList',
browser.storage.local.get('cloudflareBlackList',
async r => {
scribeNormalRedirectsChecks = [...redirects.scribe.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
let i = scribeNormalRedirectsChecks.indexOf(instance);
if (i > -1) scribeNormalRedirectsChecks.splice(i, 1);
}

View File

@ -122,9 +122,9 @@ function initDefaults() {
return new Promise(resolve => {
fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data);
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get('cloudflareBlackList', async r => {
simpleertubeNormalRedirectsChecks = [...redirects.simpleertube.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
let i = simpleertubeNormalRedirectsChecks.indexOf(instance);
if (i > -1) simpleertubeNormalRedirectsChecks.splice(i, 1);
}

View File

@ -17,11 +17,11 @@ let redirects = {
},
};
function setRedirects(val) {
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get('cloudflareBlackList', r => {
redirects = val;
libredditNormalRedirectsChecks = [...redirects.libreddit.normal];
tedditNormalRedirectsChecks = [...redirects.teddit.normal]
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = libredditNormalRedirectsChecks.indexOf(instance);
if (a > -1) libredditNormalRedirectsChecks.splice(a, 1);
@ -322,10 +322,10 @@ function initDefaults() {
let dataJson = JSON.parse(data);
redirects.teddit = dataJson.teddit;
redirects.libreddit = dataJson.libreddit;
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get('cloudflareBlackList', async r => {
libredditNormalRedirectsChecks = [...redirects.libreddit.normal];
tedditNormalRedirectsChecks = [...redirects.teddit.normal]
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
let i;
i = libredditNormalRedirectsChecks.indexOf(instance);

View File

@ -28,12 +28,12 @@ let redirects = {
};
function setRedirects(val) {
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get('cloudflareBlackList', r => {
redirects = val;
searxNormalRedirectsChecks = [...redirects.searx.normal];
searxngNormalRedirectsChecks = [...redirects.searxng.normal];
whoogleNormalRedirectsChecks = [...redirects.whoogle.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = searxNormalRedirectsChecks.indexOf(instance);
if (a > -1) searxNormalRedirectsChecks.splice(a, 1);
@ -394,11 +394,11 @@ function initDefaults() {
redirects.searxng = dataJson.searxng;
redirects.whoogle = dataJson.whoogle;
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get('cloudflareBlackList', async r => {
whoogleNormalRedirectsChecks = [...redirects.whoogle.normal];
searxNormalRedirectsChecks = [...redirects.searx.normal];
searxngNormalRedirectsChecks = [...redirects.searxng.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
let i;
i = whoogleNormalRedirectsChecks.indexOf(instance);

View File

@ -15,10 +15,10 @@ let redirects = {
}
}
function setRedirects(val) {
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get('cloudflareBlackList', r => {
redirects.send = val;
sendNormalRedirectsChecks = [...redirects.send.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = sendNormalRedirectsChecks.indexOf(instance);
if (a > -1) sendNormalRedirectsChecks.splice(a, 1);
}
@ -117,9 +117,9 @@ function initDefaults() {
fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data);
redirects.send = dataJson.send;
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get('cloudflareBlackList', async r => {
sendNormalRedirectsChecks = [...redirects.send.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
let i = sendNormalRedirectsChecks.indexOf(instance);
if (i > -1) sendNormalRedirectsChecks.splice(i, 1);
}

View File

@ -13,10 +13,10 @@ let redirects = {
}
}
function setRedirects(val) {
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get('cloudflareBlackList', r => {
redirects.proxiTok = val;
proxiTokNormalRedirectsChecks = [...redirects.proxiTok.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = proxiTokNormalRedirectsChecks.indexOf(instance);
if (a > -1) proxiTokNormalRedirectsChecks.splice(a, 1);
}

View File

@ -73,20 +73,16 @@ init();
browser.storage.onChanged.addListener(init)
function setRedirects(val) {
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get('cloudflareBlackList', r => {
redirects = val;
simplyTranslateNormalRedirectsChecks = [...redirects.simplyTranslate.normal];
lingvaNormalRedirectsChecks = [...redirects.lingva.normal]
for (const instance of r.cloudflareList) {
const a = simplyTranslateNormalRedirectsChecks.indexOf(instance);
if (a > -1) simplyTranslateNormalRedirectsChecks.splice(a, 1);
const b = lingvaNormalRedirectsChecks.indexOf(instance);
if (b > -1) lingvaNormalRedirectsChecks.splice(b, 1);
for (const instance of r.cloudflareBlackList) {
const i = lingvaNormalRedirectsChecks.indexOf(instance);
if (i > -1) lingvaNormalRedirectsChecks.splice(i, 1);
}
browser.storage.local.set({
translateRedirects: redirects,
simplyTranslateNormalRedirectsChecks,
simplyTranslateNormalRedirectsChecks: redirects.simplyTranslate.normal,
simplyTranslateTorRedirectsChecks: redirects.simplyTranslate.tor,
lingvaNormalRedirectsChecks,
lingvaTorRedirectsChecks: redirects.lingva.tor,
@ -261,16 +257,12 @@ function initDefaults() {
let dataJson = JSON.parse(data);
redirects.simplyTranslate = dataJson.simplyTranslate;
redirects.lingva = dataJson.lingva;
browser.storage.local.get('cloudflareList',
browser.storage.local.get('cloudflareBlackList',
async r => {
simplyTranslateNormalRedirectsChecks = [...redirects.simplyTranslate.normal];
lingvaNormalRedirectsChecks = [...redirects.lingva.normal]
for (const instance of r.cloudflareList) {
const a = simplyTranslateNormalRedirectsChecks.indexOf(instance);
if (a > -1) simplyTranslateNormalRedirectsChecks.splice(a, 1);
const b = lingvaNormalRedirectsChecks.indexOf(instance);
if (b > -1) lingvaNormalRedirectsChecks.splice(b, 1);
for (const instance of r.cloudflareBlackList) {
const i = lingvaNormalRedirectsChecks.indexOf(instance);
if (i > -1) lingvaNormalRedirectsChecks.splice(i, 1);
}
await browser.storage.local.set({
translateDisable: false,
@ -279,7 +271,7 @@ function initDefaults() {
translateRedirects: redirects,
simplyTranslateNormalRedirectsChecks: simplyTranslateNormalRedirectsChecks,
simplyTranslateNormalCustomRedirects: [],
simplyTranslateNormalCustomRedirects: [...redirects.simplyTranslate.normal],
simplyTranslateTorRedirectsChecks: [...redirects.simplyTranslate.tor],
simplyTranslateTorCustomRedirects: [],

View File

@ -17,10 +17,10 @@ let redirects = {
};
function setRedirects(val) {
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get(['cloudflareBlackList', 'authenticateBlackList'], r => {
redirects.nitter = val;
nitterNormalRedirectsChecks = [...redirects.nitter.normal];
for (const instance of r.cloudflareList) {
for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList]) {
let i = nitterNormalRedirectsChecks.indexOf(instance);
if (i > -1) nitterNormalRedirectsChecks.splice(i, 1);
}
@ -204,9 +204,9 @@ function initDefaults() {
fetch('/instances/data.json').then(response => response.text()).then(data => {
let dataJson = JSON.parse(data);
redirects.nitter = dataJson.nitter;
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get(['cloudflareBlackList', 'authenticateBlackList'], async r => {
nitterNormalRedirectsChecks = [...redirects.nitter.normal];
for (const instance of r.cloudflareList) {
for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList]) {
let i = nitterNormalRedirectsChecks.indexOf(instance);
if (i > -1) nitterNormalRedirectsChecks.splice(i, 1);
}

View File

@ -18,11 +18,13 @@ function getRandomInstance(instances) {
return instances[~~(instances.length * Math.random())];
}
let cloudflareList = [];
async function initCloudflareList() {
let cloudflareBlackList = [];
let authenticateBlackList = [];
async function initcloudflareBlackList() {
return new Promise(resolve => {
fetch('/instances/blocklist.json').then(response => response.text()).then(data => {
cloudflareList = JSON.parse(data);
fetch('/instances/blacklist.json').then(response => response.text()).then(data => {
cloudflareBlackList = JSON.parse(data).cloudflare;
authenticateBlackList = JSON.parse(data).authenticate;
resolve();
})
});
@ -34,7 +36,7 @@ function updateInstances() {
http.open('GET', 'https://raw.githubusercontent.com/libredirect/libredirect/master/src/instances/data.json', false);
http.send(null);
if (http.status === 200) {
await initCloudflareList();
await initcloudflareBlackList();
const instances = JSON.parse(http.responseText);
youtubeHelper.setRedirects({ 'invidious': instances.invidious, 'piped': instances.piped, })
@ -73,7 +75,7 @@ async function processDefaultCustomInstances(target, name, protocol, document) {
let nameCustomInstances = [];
let nameCheckListElement = nameProtocolElement.getElementsByClassName('checklist')[0];
await initCloudflareList();
await initcloudflareBlackList();
let nameDefaultRedirects;
@ -123,7 +125,8 @@ async function processDefaultCustomInstances(target, name, protocol, document) {
</div>`,
...redirects[name][protocol].map(
x => {
let cloudflare = cloudflareList.includes(x) ? ' <span style="color:red;">cloudflare</span>' : '';
const cloudflare = cloudflareBlackList.includes(x) ? ' <span style="color:red;">cloudflare</span>' : '';
const authenticate = authenticateBlackList.includes(x) ? ' <span style="color:orange;">authenticate</span>' : '';
let ms = instancesLatency[x];
let latencyColor = (ms <= 1000 ? "green" : ms <= 2000 ? "orange" : "red");
@ -132,10 +135,11 @@ async function processDefaultCustomInstances(target, name, protocol, document) {
else if (ms > 5000) latencyLimit = `ERROR: ${ms - 5000}`;
else latencyLimit = ms + 'ms';
let latency = x in instancesLatency ? '<span style="color:' + latencyColor + ';">' + latencyLimit + '</span>' : '';
const latency = x in instancesLatency ? '<span style="color:' + latencyColor + ';">' + latencyLimit + '</span>' : '';
let warnings = [cloudflare, authenticate, latency].join(' ');
return `<div>
<x><a href="${x}" target="_blank">${x}</a>${cloudflare} ${latency}</x>
<x><a href="${x}" target="_blank">${x}</a>${warnings}</x>
<input type="checkbox" class="${x}"/>
</div>`;
}

View File

@ -12,10 +12,10 @@ let redirects = {
}
};
function setRedirects(val) {
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get('cloudflareBlackList', r => {
redirects.wikiless = val;
wikilessNormalRedirectsChecks = [...redirects.wikiless.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = wikilessNormalRedirectsChecks.indexOf(instance);
if (a > -1) wikilessNormalRedirectsChecks.splice(a, 1);
}
@ -180,9 +180,9 @@ function initDefaults() {
fetch('/instances/data.json').then(response => response.text()).then(async data => {
let dataJson = JSON.parse(data);
redirects.wikiless = dataJson.wikiless;
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get('cloudflareBlackList', async r => {
wikilessNormalRedirectsChecks = [...redirects.wikiless.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
let i = wikilessNormalRedirectsChecks.indexOf(instance);
if (i > -1) wikilessNormalRedirectsChecks.splice(i, 1);
}

View File

@ -34,12 +34,12 @@ let redirects = {
}
};
function setRedirects(val) {
browser.storage.local.get('cloudflareList', r => {
browser.storage.local.get('cloudflareBlackList', r => {
redirects.invidious = val.invidious;
redirects.piped = val.piped;
invidiousNormalRedirectsChecks = [...redirects.invidious.normal];
pipedNormalRedirectsChecks = [...redirects.piped.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = invidiousNormalRedirectsChecks.indexOf(instance);
if (a > -1) invidiousNormalRedirectsChecks.splice(a, 1);
@ -245,13 +245,13 @@ function initDefaults() {
let dataJson = JSON.parse(data);
redirects.invidious = dataJson.invidious;
redirects.piped = dataJson.piped;
browser.storage.local.get('cloudflareList', async r => {
browser.storage.local.get('cloudflareBlackList', async r => {
invidiousNormalRedirectsChecks = [...redirects.invidious.normal];
pipedNormalRedirectsChecks = [...redirects.piped.normal];
pipedMaterialNormalRedirectsChecks = [...redirects.pipedMaterial.normal];
for (const instance of r.cloudflareList) {
for (const instance of r.cloudflareBlackList) {
const a = invidiousNormalRedirectsChecks.indexOf(instance);
if (a > -1) invidiousNormalRedirectsChecks.splice(a, 1);

View File

@ -0,0 +1,52 @@
{
"cloudflare": [
"https://invidious.kavin.rocks",
"https://invidious.lunar.icu",
"https://piped.kavin.rocks",
"https://piped.tokhmi.xyz",
"https://piped.moomoo.me",
"https://piped.syncpundit.com",
"https://piped.mha.fi",
"https://piped.shimul.me",
"https://nitter.domain.glass",
"https://birdsite.xanny.family",
"https://nitter.moomoo.me",
"https://notabird.site",
"https://fuckthesacklers.network",
"https://nitter.winscloud.net",
"https://twtr.bch.bar",
"https://nitter.lunar.icu",
"https://twitter.dr460nf1r3.org",
"https://bib.actionsack.com",
"https://libreddit.domain.glass",
"https://r.nf",
"https://libreddit.flux.industries",
"https://lr.oversold.host",
"https://libreddit.hu",
"https://lr.stilic.ml",
"https://reddi.tk",
"https://r.walkx.org",
"https://libreddit.yonalee.eu",
"https://libreddit.winscloud.net",
"https://libreddit.lunar.icu",
"https://r.ahwx.org",
"https://reddit.dr460nf1r3.org",
"https://teddit.domain.glass",
"https://wiki.604kph.xyz",
"https://wikiless.lunar.icu",
"https://lingva.lunar.icu",
"https://searx.josie.lol",
"https://searx.org",
"https://searx.run",
"https://searx.albony.xyz",
"https://search.albony.xyz",
"https://search.garudalinux.org",
"https://search.dr460nf1r3.org",
"https://whoogle.lunar.icu",
"https://rimgo.lunar.icu",
"https://i.actionsack.com"
],
"authenticate": [
"https://nitter.nixnet.services"
]
}

View File

@ -329,7 +329,8 @@
"https://tl.vern.cc",
"https://translate.slipfox.xyz",
"https://st.privacydev.net",
"https://translate.beparanoid.de"
"https://translate.beparanoid.de",
"https://translate.priv.pw"
],
"tor": [
"http://fyng2tsmzmvxmojzbbwmfnsn2lrcyftf4cw6rk5j2v2huliazud3fjid.onion",
@ -367,7 +368,6 @@
"normal": [
"https://anon.sx",
"https://dynabyte.ca",
"https://engo.mint.lgbt",
"https://jsearch.pw",
"https://nibblehole.com",
"https://search.antonkling.se",
@ -383,14 +383,12 @@
"https://searx.dresden.network",
"https://searx.fossencdi.org",
"https://searx.gnu.style",
"https://searx.jaska.cc",
"https://searx.josie.lol",
"https://searx.kujonello.cf",
"https://searx.mastodontech.de",
"https://searx.mxchange.org",
"https://searx.nakhan.net",
"https://searx.netzspielplatz.de",
"https://searx.ninja",
"https://searx.nixnet.services",
"https://searx.openhoofd.nl",
"https://searx.org",
@ -404,7 +402,6 @@
"https://searx.sp-codes.de",
"https://searx.stuehieyr.com",
"https://searx.theanonymouse.xyz",
"https://searx.tk",
"https://searx.tux.land",
"https://searx.tuxcloud.net",
"https://searx.tyil.nl",
@ -419,7 +416,6 @@
"https://sx.catgirl.cloud",
"https://timdor.noip.me/searx",
"https://www.gruble.de",
"https://yuno.zecircle.xyz/yunohost/sso/?r=aHR0cHM6Ly9zZWFyeC56ZWNpcmNsZS54eXov",
"https://searx.roflcopter.fr"
]
},
@ -435,6 +431,7 @@
],
"i2p": [],
"normal": [
"https://asowneryt.cloudns.nz",
"https://darmarit.org/searx",
"https://etsi.me",
"https://northboot.xyz",
@ -442,6 +439,7 @@
"https://procurx.pt",
"https://s.zhaocloud.net",
"https://search.bus-hit.me",
"https://search.chemicals-in-the-water.eu",
"https://search.mdosch.de",
"https://search.neet.works",
"https://search.ononoki.org",
@ -485,7 +483,8 @@
"https://www.whooglesearch.ml",
"https://whoogle.dcs0.hu",
"https://whoogle.esmailelbob.xyz",
"https://whoogle.lunar.icu"
"https://whoogle.lunar.icu",
"https://whoogle.privacydev.net"
],
"tor": [],
"i2p": []
@ -589,14 +588,12 @@
"https://video.linc.systems",
"https://video.sftblw.moe",
"https://peertube.dsmouse.net",
"https://tube.govital.net",
"https://ptube.horsentiers.fr",
"https://media.reseaumilitant.org",
"https://video.cnt.social",
"https://peertube.okko.io",
"https://video.mentality.rip",
"https://tube.03281.fspfc.org",
"https://videos.casually.cat",
"https://tube.linc.systems",
"https://artefac-paris.tv",
"https://peertube.ketchup.noho.st",
@ -967,10 +964,8 @@
"https://peertube.myrasp.eu",
"https://watch.softinio.com",
"https://peertube.plataformess.org",
"https://tv1.gomntu.space",
"https://tube.arthack.nz",
"https://tv.atmx.ca",
"https://tube.superseriousbusiness.org",
"https://kino.kompot.si",
"https://tube.kockatoo.org",
"https://peertube.cabaal.net",
@ -1095,7 +1090,6 @@
"https://videos.thisishowidontdisappear.com",
"https://video.islameye.com",
"https://tube.kotur.org",
"https://v.szy.io",
"https://peertube.euskarabildua.eus",
"https://video.veloma.org",
"https://vidcommons.org",
@ -1259,7 +1253,6 @@
"https://tube.rita.moe",
"https://tuktube.com",
"https://v.basspistol.org",
"https://mojotube.net",
"https://mytube.kn-cloud.de",
"https://tube.nuagelibre.fr",
"https://video.nogafam.es",

View File

@ -57,7 +57,6 @@ def is_cloudflare(url):
cloudflare_bin = ip2bin(cloudflare_ip)
mask = int(cloudflare_ip_mask.split('/')[1])
cloudflare_bin_masked = cloudflare_bin[:mask]
instance_bin_masked = instance_bin[:mask]
@ -71,6 +70,7 @@ def is_authenticate(url):
try:
r = requests.get(url, timeout=5)
if 'www-authenticate' in r.headers:
print(url + ' is ' + Fore.RED + 'authenticate' + Style.RESET_ALL)
return True
except:
return False
@ -376,7 +376,8 @@ searx_searxng()
whoogle()
rimgo()
blocklist = []
cloudflare = []
authenticate = []
for k1, v1 in mightyList.items():
if type(mightyList[k1]) is dict:
for k2, v2 in mightyList[k1].items():
@ -386,12 +387,16 @@ for k1, v1 in mightyList.items():
print("removed " + instance)
else:
if not instance.endswith('.onion') and not instance.endswith('.i2p') and is_cloudflare(instance):
blocklist.append(instance)
cloudflare.append(instance)
if not instance.endswith('.onion') and not instance.endswith('.i2p') and is_authenticate(instance):
blocklist.append(instance)
authenticate.append(instance)
peertube()
blacklist = {
'cloudflare': cloudflare,
'authenticate': authenticate
}
# Writing to file
json_object = json.dumps(mightyList, ensure_ascii=False, indent=2)
@ -399,9 +404,9 @@ with open('./src/instances/data.json', 'w') as outfile:
outfile.write(json_object)
print(Fore.BLUE + 'wrote ' + Style.RESET_ALL + 'instances/data.json')
json_object = json.dumps(blocklist, ensure_ascii=False, indent=2)
with open('./src/instances/blocklist.json', 'w') as outfile:
json_object = json.dumps(blacklist, ensure_ascii=False, indent=2)
with open('./src/instances/blacklist.json', 'w') as outfile:
outfile.write(json_object)
print(Fore.BLUE + 'wrote ' + Style.RESET_ALL + 'instances/blocklist')
print(Fore.BLUE + 'wrote ' + Style.RESET_ALL + 'instances/blacklist.json')
# print(json_object)

View File

@ -26,9 +26,10 @@ browser.runtime.onInstalled.addListener(
// if (details.reason == 'install') {
if (details.reason == 'install' || details.reason == "update") {
if (details.reason == "update") browser.tabs.create({ url: browser.runtime.getURL("/pages/background/reset_warning.html") });
fetch('/instances/blocklist.json').then(response => response.text()).then(async data => {
fetch('/instances/blacklist.json').then(response => response.text()).then(async data => {
await browser.storage.local.clear();
await browser.storage.local.set({ cloudflareList: JSON.parse(data) })
await browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare })
await browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate })
generalHelper.initDefaults();
youtubeHelper.initDefaults();
youtubeMusicHelper.initDefaults();
@ -65,7 +66,7 @@ let BYPASSTABs = [];
browser.webRequest.onBeforeRequest.addListener(
details => {
const url = new URL(details.url);
if (new RegExp(/^chrome-extension:\/{2}.*\/instances\/(blocklist|data).json$/).test(url.href) && details.type == 'xmlhttprequest') return;
if (new RegExp(/^chrome-extension:\/{2}.*\/instances\/.*.json$/).test(url.href) && details.type == 'xmlhttprequest') return;
let initiator;
try {
if (details.originUrl) initiator = new URL(details.originUrl);

View File

@ -63,7 +63,7 @@ importSettingsElement.addEventListener("change",
if (
"theme" in data &&
"disableImgur" in data &&
"cloudflareList" in data &&
"cloudflareBlackList" in data &&
"imgurRedirects" in data
) {
await browser.storage.local.clear();
@ -104,8 +104,9 @@ resetSettings.addEventListener("click",
async () => {
resetSettings.innerHTML = '...'
await browser.storage.local.clear();
fetch('/instances/blocklist.json').then(response => response.text()).then(async data => {
await browser.storage.local.set({ cloudflareList: JSON.parse(data) })
fetch('/instances/blacklist.json').then(response => response.text()).then(async data => {
await browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare })
await browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate })
await generalHelper.initDefaults();
await youtubeHelper.initDefaults();
await youtubeMusicHelper.initDefaults();