summaryrefslogtreecommitdiffstats
path: root/addon_chrome/ismitmlink/bg.js
diff options
context:
space:
mode:
authorIHateCaptcha <i@hate.captcha>2019-06-14 07:31:29 +0000
committerIHateCaptcha <i@hate.captcha>2019-06-14 07:31:29 +0000
commitcbba07c1e19f7e3fd55ffbf0be4d8f4294241396 (patch)
tree4017c7050fe6d98b12dcfc9b64b88e1761f382d9 /addon_chrome/ismitmlink/bg.js
parent5e1e2d942d9b6879020d9f0e79b8003737701bf6 (diff)
downloadcloudflare-tor-cbba07c1e19f7e3fd55ffbf0be4d8f4294241396.tar
cloudflare-tor-cbba07c1e19f7e3fd55ffbf0be4d8f4294241396.tar.gz
cloudflare-tor-cbba07c1e19f7e3fd55ffbf0be4d8f4294241396.tar.lz
cloudflare-tor-cbba07c1e19f7e3fd55ffbf0be4d8f4294241396.tar.xz
cloudflare-tor-cbba07c1e19f7e3fd55ffbf0be4d8f4294241396.zip
v1.0.8 GC
Diffstat (limited to 'addon_chrome/ismitmlink/bg.js')
-rw-r--r--addon_chrome/ismitmlink/bg.js39
1 files changed, 26 insertions, 13 deletions
diff --git a/addon_chrome/ismitmlink/bg.js b/addon_chrome/ismitmlink/bg.js
index ce5525dd..5f585ff9 100644
--- a/addon_chrome/ismitmlink/bg.js
+++ b/addon_chrome/ismitmlink/bg.js
@@ -1,17 +1,15 @@
let apiurl = 'https://searxes.eu.org/collab/open/ismitm.php';
-let TORapiurl = 'http://searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion/collab/open/ismitm.php';
fetch('http://xxf4en4djo7hhvatax2g3lvj2qgvbwi4yeyyzwpo25zcog4ewhsbrdyd.onion/ok.php', {
method: 'GET',
mode: 'cors'
}).then(r => r.text()).then(r => {
if (r == 'ok') {
- apiurl = TORapiurl;
+ apiurl = 'http://searxes.nmqnkngye4ct7bgss4bmv5ca3wpa55yugvxen5kz2bbq67lwy6ps54yd.onion/collab/open/ismitm.php';
}
}).catch(() => {});
function is_infected(f) {
- console.log(f);
return new Promise((g, b) => {
fetch(apiurl, {
method: 'POST',
@@ -49,20 +47,33 @@ function i_already_know_you(f) {
});
}
-function i_remember_you(f, t) {
+function clear_cache_2w() {
+ chrome.storage.local.clear();
chrome.storage.local.set({
- [f]: ((t) ? 'y' : 'n')
+ 'lastU': Math.round((new Date()).getTime() / 1000)
});
-}
-
-function clear_cache_week() {
- chrome.storage.local.clear();
setTimeout(function () {
- clear_cache();
- }, 604800000);
+ clear_cache_2w();
+ }, 1209600000);
}
-clear_cache_week();
+chrome.storage.local.get('lastxU', (g) => {
+ if (g.lastU) {
+ if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 1209600) {
+ chrome.storage.local.clear();
+ chrome.storage.local.set({
+ 'lastU': Math.round((new Date()).getTime() / 1000)
+ });
+ }
+ } else {
+ chrome.storage.local.set({
+ 'lastU': Math.round((new Date()).getTime() / 1000)
+ });
+ }
+ setTimeout(function () {
+ clear_cache_2w();
+ }, 1209600000);
+});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request) {
@@ -72,7 +83,9 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
}
if (r == 0) {
is_infected(request).then((a) => {
- i_remember_you(request, a);
+ chrome.storage.local.set({
+ [request]: ((a) ? 'y' : 'n')
+ });
chrome.tabs.sendMessage(sender.tab.id, [request, a]);
}, () => {
chrome.tabs.sendMessage(sender.tab.id, [request, false]);