0
0
mirror of https://codeberg.org/crimeflare/cloudflare-tor synced 2024-12-20 23:26:39 +01:00
cloudflare-tor/addons/urejectFX/bg.js

34 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-07-31 01:17:43 +02:00
let history = {};
browser.webRequest.onResponseStarted.addListener(i => {
if ([403, 406, 410, 429, 451, 462].includes(i.statusCode)) {
let iFQDN = (new URL(i.url)).hostname;
2020-11-10 08:42:10 +01:00
if (['crimeflare.eu.org', 'ansero.eu.org', 'cfe.nnpaefp7pkadbxxkhz2agtbv2a4g5sgo2fbmv3i7czaua354334uqqad.onion', 'ansero.nnpaefp7pkadbxxkhz2agtbv2a4g5sgo2fbmv3i7czaua354334uqqad.onion'].includes(iFQDN)) {
2020-07-31 01:17:43 +02:00
return;
}
let iServer = '?';
i.responseHeaders.forEach(x => {
2020-09-13 01:43:23 +02:00
if (x.name.toLowerCase() == 'server') {
2020-07-31 01:17:43 +02:00
iServer = x.value;
}
});
history[iFQDN] = [i.url, iServer, i.statusCode, (new Date()).toUTCString()];
}
return;
}, {
urls: ['http://*/*', 'https://*/*'],
types: ['main_frame']
}, ['responseHeaders']);
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request && sender) {
if (request == 'get') {
sendResponse(history);
}
if (request == 'clear') {
history = {};
sendResponse(true);
}
}
});
browser.browserAction.onClicked.addListener(() => {
browser.runtime.openOptionsPage();
});