diff options
author | cloudflaredns <cloud@flare.dns> | 2019-05-20 14:41:38 +0000 |
---|---|---|
committer | cloudflaredns <cloud@flare.dns> | 2019-05-20 14:41:38 +0000 |
commit | 4daec001868ebb056ff141c2f00a8f49adc8154a (patch) | |
tree | f45160f07bff34625e120df1332b60cbdaacc412 /addon_chrome/whyrejectme/bg.js | |
parent | 2384a610d7005c79cf853bd77462554257d1a424 (diff) | |
download | cloudflare-tor-4daec001868ebb056ff141c2f00a8f49adc8154a.tar cloudflare-tor-4daec001868ebb056ff141c2f00a8f49adc8154a.tar.gz cloudflare-tor-4daec001868ebb056ff141c2f00a8f49adc8154a.tar.lz cloudflare-tor-4daec001868ebb056ff141c2f00a8f49adc8154a.tar.xz cloudflare-tor-4daec001868ebb056ff141c2f00a8f49adc8154a.zip |
Upload files to 'addon_chrome/whyrejectme'
Diffstat (limited to 'addon_chrome/whyrejectme/bg.js')
-rw-r--r-- | addon_chrome/whyrejectme/bg.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/addon_chrome/whyrejectme/bg.js b/addon_chrome/whyrejectme/bg.js new file mode 100644 index 00000000..13b5464d --- /dev/null +++ b/addon_chrome/whyrejectme/bg.js @@ -0,0 +1,34 @@ +let history = {}; + +chrome.webRequest.onResponseStarted.addListener(i => { + if ([403, 406, 410, 451, 462].includes(i.statusCode)) { + let iFQDN = (new URL(i.url)).hostname; + if (iFQDN == 'searxes.eu.org' || iFQDN == 'AAAsearxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion') { + return; + } + let iServer = 'Unknown'; + i.responseHeaders.forEach(x => { + if (x.name == 'Server') { + iServer = x.value; + } + }); + let iDate = (new Date()).toUTCString(); + history[iFQDN] = [i.url, iServer, i.statusCode, iDate]; + } + return; +}, { + urls: ['http://*/*', 'https://*/*'], + types: ['main_frame'] +}, ['responseHeaders']); + +chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { + if (request && sender) { + if (request == 'get') { + sendResponse(history); + } + if (request == 'clear') { + history = {}; + sendResponse(true); + } + } +});
\ No newline at end of file |