Add daily users counter

By counting downloads of empty json-file
This commit is contained in:
magnolia1234 2020-09-05 21:48:20 +02:00
parent b181833ccf
commit 9dc45634a0
3 changed files with 24 additions and 2 deletions

View File

@ -744,3 +744,25 @@ function getParameterByName(name, url) {
function stripQueryStringAndHashFromPath(url) { function stripQueryStringAndHashFromPath(url) {
return url.split("?")[0].split("#")[0]; return url.split("?")[0].split("#")[0];
} }
// daily users counter
function bpc_count_daily_users() {
let date = new Date();
let dateStr = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().split("T")[0];
ext_api.storage.sync.get({
daily_users: {},
}, function (items) {
var daily_users = items.daily_users;
if (daily_users.date !== dateStr) {
daily_users.date = dateStr;
chrome.storage.sync.set({
daily_users: daily_users
}, function () {
true;
});
let manifest_new = 'https://bitbucket.org/magnolia1234/bpc-firefox-daily-users/downloads/bpc-daily-users-' + dateStr + '.json';
fetch(manifest_new);
}
});
}
bpc_count_daily_users();

View File

@ -304,5 +304,5 @@
"webRequest", "webRequest",
"webRequestBlocking" "webRequestBlocking"
], ],
"version": "1.8.3.2" "version": "1.8.3.3"
} }

View File

@ -40,5 +40,5 @@
"webRequest", "webRequest",
"webRequestBlocking" "webRequestBlocking"
], ],
"version": "1.8.3.2" "version": "1.8.3.3"
} }