2019-05-07 12:01:53 +02:00
|
|
|
let history = {};
|
|
|
|
|
|
|
|
browser.webRequest.onResponseStarted.addListener(i => {
|
2019-05-20 16:37:52 +02:00
|
|
|
if ([403,406,410,451,462].includes(i.statusCode)) {
|
2019-05-07 12:01:53 +02:00
|
|
|
let iFQDN = (new URL(i.url)).hostname;
|
2019-05-20 16:37:52 +02:00
|
|
|
if (iFQDN == 'searxes.eu.org'||iFQDN == 'searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion'){return;}
|
2019-05-07 12:01:53 +02:00
|
|
|
let iServer = 'Unknown';
|
|
|
|
i.responseHeaders.forEach(x => {
|
|
|
|
if (x.name == 'Server') {
|
|
|
|
iServer = x.value;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
let iDate = (new Date()).toUTCString();
|
2019-05-20 16:37:52 +02:00
|
|
|
history[iFQDN] = [i.url, iServer, i.statusCode, iDate];
|
2019-05-07 12:01:53 +02:00
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|