1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Implemented notification if something changed on CDNs or frameworks

This commit is contained in:
nobody
2020-03-08 12:30:03 +01:00
parent 40ea8a2625
commit 48283328c7
10 changed files with 221 additions and 5 deletions

View File

@@ -32,6 +32,7 @@ main._initializeSettings = function () {
[Setting.DISABLE_PREFETCH]: true,
[Setting.ENFORCE_STAGING]: false,
[Setting.STRIP_METADATA]: true,
[Setting.LAST_MAPPING_UPDATE]: "2020-01-01",
[Setting.WHITELISTED_DOMAINS]: {}
};
@@ -60,12 +61,12 @@ main._initializeSettings = function () {
main._showReleaseNotes = function (details) {
let location, previousVersion;
let location, updateAdBlockerRules, previousVersion;
location = chrome.extension.getURL('pages/welcome/welcome.html');
updateAdBlockerRules = chrome.extension.getURL('pages/updates/updates.html');
if (details.reason === chrome.runtime.OnInstalledReason.INSTALL ||
details.reason === chrome.runtime.OnInstalledReason.UPDATE) {
if (details.reason === chrome.runtime.OnInstalledReason.INSTALL) {
previousVersion = details.previousVersion;
@@ -88,6 +89,22 @@ main._showReleaseNotes = function (details) {
}
});
}
} else if (details.reason === chrome.runtime.OnInstalledReason.UPDATE) {
// If add-on update true, check last update of mappings.js
chrome.storage.local.get({[Setting.LAST_MAPPING_UPDATE]: lastMappingUpdate}, function (items) {
if (items.lastMappingUpdate !== lastMappingUpdate) {
// Updated mappings.js
chrome.tabs.create({
'url': updateAdBlockerRules,
'active': true
});
chrome.storage.local.set({
[Setting.LAST_MAPPING_UPDATE]: lastMappingUpdate
});
} else {
// No mappings.js update
}
});
}
};