summaryrefslogtreecommitdiffstats
path: root/addon_chrome/ismitmlink/bg.js
diff options
context:
space:
mode:
authorcloudflarewarp <cloudflarewarp@noreply.codeberg.org>2019-08-05 01:57:33 +0200
committercloudflarewarp <cloudflarewarp@noreply.codeberg.org>2019-08-05 01:57:33 +0200
commit9589e891b7adae5290efe731cf41fd0c60edf2b3 (patch)
tree88429fb9b3faa6ae4016482c23f347c0af1d795a /addon_chrome/ismitmlink/bg.js
parentb67803d6ccd6221365743049ea51af58909441fe (diff)
downloadcloudflare-tor-9589e891b7adae5290efe731cf41fd0c60edf2b3.tar
cloudflare-tor-9589e891b7adae5290efe731cf41fd0c60edf2b3.tar.gz
cloudflare-tor-9589e891b7adae5290efe731cf41fd0c60edf2b3.tar.lz
cloudflare-tor-9589e891b7adae5290efe731cf41fd0c60edf2b3.tar.xz
cloudflare-tor-9589e891b7adae5290efe731cf41fd0c60edf2b3.zip
Upload files to 'addon_chrome/ismitmlink'
Diffstat (limited to 'addon_chrome/ismitmlink/bg.js')
-rw-r--r--addon_chrome/ismitmlink/bg.js28
1 files changed, 20 insertions, 8 deletions
diff --git a/addon_chrome/ismitmlink/bg.js b/addon_chrome/ismitmlink/bg.js
index 53beb299..41588aef 100644
--- a/addon_chrome/ismitmlink/bg.js
+++ b/addon_chrome/ismitmlink/bg.js
@@ -1,5 +1,4 @@
let apiurl = 'https://api.searxes.eu.org/_/ismitm.php';
-
fetch('http://api.xxf4en4djo7hhvatax2g3lvj2qgvbwi4yeyyzwpo25zcog4ewhsbrdyd.onion/_/ok.php', {
method: 'GET',
mode: 'cors'
@@ -47,19 +46,22 @@ function i_already_know_you(f) {
});
}
-function clear_cache_2w() {
+function clear_cache_1w() {
chrome.storage.local.clear();
chrome.storage.local.set({
'lastU': Math.round((new Date()).getTime() / 1000)
});
+ chrome.storage.local.set({
+ 'lastV': (chrome.runtime.getManifest()).version
+ });
setTimeout(function () {
- clear_cache_2w();
- }, 1209600000);
+ clear_cache_1w();
+ }, 604800000);
}
-chrome.storage.local.get('lastxU', (g) => {
+chrome.storage.local.get(['lastU', 'lastV'], (g) => {
if (g.lastU) {
- if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 1209600) {
+ if (Math.abs(Math.round((new Date()).getTime() / 1000) - g.lastU) > 604800) {
chrome.storage.local.clear();
chrome.storage.local.set({
'lastU': Math.round((new Date()).getTime() / 1000)
@@ -70,9 +72,19 @@ chrome.storage.local.get('lastxU', (g) => {
'lastU': Math.round((new Date()).getTime() / 1000)
});
}
+ let nowVer = (chrome.runtime.getManifest()).version;
+ if (g.lastV != nowVer) {
+ chrome.storage.local.clear();
+ chrome.storage.local.set({
+ 'lastU': Math.round((new Date()).getTime() / 1000)
+ });
+ chrome.storage.local.set({
+ 'lastV': nowVer
+ });
+ }
setTimeout(function () {
- clear_cache_2w();
- }, 1209600000);
+ clear_cache_1w();
+ }, 604800000);
});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {