Redirect only for Server Error Responses #6
This commit is contained in:
parent
7c8d236367
commit
bdfa63acef
|
@ -13,6 +13,7 @@ const targets = [
|
||||||
"mobile.twitter.com",
|
"mobile.twitter.com",
|
||||||
"pbs.twimg.com",
|
"pbs.twimg.com",
|
||||||
"video.twimg.com",
|
"video.twimg.com",
|
||||||
|
"platform.twitter.com"
|
||||||
];
|
];
|
||||||
|
|
||||||
let redirects = {
|
let redirects = {
|
||||||
|
@ -58,7 +59,9 @@ let redirects = {
|
||||||
"https://fuckthesacklers.network",
|
"https://fuckthesacklers.network",
|
||||||
"https://nitter.govt.land",
|
"https://nitter.govt.land",
|
||||||
"https://nitter.datatunnel.xyz",
|
"https://nitter.datatunnel.xyz",
|
||||||
"https://nitter.esmailelbob.xyz"
|
"https://nitter.esmailelbob.xyz",
|
||||||
|
"https://tw.artemislena.eu",
|
||||||
|
"https://nitter.eu.org"
|
||||||
],
|
],
|
||||||
"onion": [
|
"onion": [
|
||||||
"http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion",
|
"http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion",
|
||||||
|
@ -77,7 +80,7 @@ let redirects = {
|
||||||
"http://nitraeju2mipeziu2wtcrqsxg7h62v5y4eqgwi75uprynkj74gevvuqd.onion",
|
"http://nitraeju2mipeziu2wtcrqsxg7h62v5y4eqgwi75uprynkj74gevvuqd.onion",
|
||||||
"http://nitter.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion"
|
"http://nitter.lqs5fjmajyp7rvp4qvyubwofzi6d4imua7vs237rkc4m5qogitqwrgyd.onion"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
const getRedirects = () => redirects;
|
const getRedirects = () => redirects;
|
||||||
const getCustomRedirects = function () {
|
const getCustomRedirects = function () {
|
||||||
|
@ -124,12 +127,9 @@ function setDisableTwitter(val) {
|
||||||
|
|
||||||
|
|
||||||
function redirect(url, initiator) {
|
function redirect(url, initiator) {
|
||||||
if (disableTwitter)
|
if (disableTwitter) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
if (url.pathname.split("/").includes("home")) {
|
if (url.pathname.split("/").includes("home")) return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let instancesList = [...nitterRedirectsChecks, ...nitterCustomRedirects];
|
let instancesList = [...nitterRedirectsChecks, ...nitterCustomRedirects];
|
||||||
if (instancesList.length === 0) return null;
|
if (instancesList.length === 0) return null;
|
||||||
|
@ -148,7 +148,6 @@ function redirect(url, initiator) {
|
||||||
|
|
||||||
else if (url.pathname.split("/").includes("tweets"))
|
else if (url.pathname.split("/").includes("tweets"))
|
||||||
return `${randomInstance}${url.pathname.replace("/tweets", "")}${url.search}`;
|
return `${randomInstance}${url.pathname.replace("/tweets", "")}${url.search}`;
|
||||||
|
|
||||||
else
|
else
|
||||||
return `${randomInstance}${url.pathname}${url.search}`;
|
return `${randomInstance}${url.pathname}${url.search}`;
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ browser.webRequest.onResponseStarted.addListener(
|
||||||
var mightyList = getMightyList();
|
var mightyList = getMightyList();
|
||||||
|
|
||||||
if (mightyList.includes(protocolHost)); {
|
if (mightyList.includes(protocolHost)); {
|
||||||
if (responseDetails.statusCode < 200 || responseDetails.statusCode >= 300) {
|
if (responseDetails.statusCode >= 500) {
|
||||||
console.log("Instance is corrupted, redirecting", responseDetails.url);
|
console.log("Instance is corrupted, redirecting", responseDetails.url);
|
||||||
changeInstance(responseDetails.url);
|
changeInstance(responseDetails.url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue