Fixed: Exported settings have old values (#177)

This commit is contained in:
nobody 2020-11-16 07:03:40 +01:00
parent 395dea7561
commit a6466a1cf5
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
2 changed files with 13 additions and 6 deletions

View File

@ -65,7 +65,6 @@ main._initializeSettings = function () {
}); });
} }
stateManager.selectedIcon = items.selectedIcon; stateManager.selectedIcon = items.selectedIcon;
wrappers.setIcon({ wrappers.setIcon({
'path': stateManager.selectedIcon 'path': stateManager.selectedIcon
@ -90,14 +89,22 @@ main._showReleaseNotes = function (details) {
} }
}); });
} else if (details.reason === chrome.runtime.OnInstalledReason.UPDATE) { } else if (details.reason === chrome.runtime.OnInstalledReason.UPDATE) {
storageManager.type.get([Setting.LAST_MAPPING_UPDATE, Setting.UPDATE_NOTIFICATION], function (items) { storageManager.type.get(null, function (items) {
let mappingUpdate = items.lastMappingUpdate !== mappings.lastMappingUpdate; let mappingUpdate = items.lastMappingUpdate !== mappings.lastMappingUpdate;
// Remove old keys
for (const key of Object.keys(items)) {
if (!(key in SettingDefaults)) {
delete items[key];
}
}
// Override old value https://codeberg.org/nobody/LocalCDN/issues/177
items.xhrTestDomain = 'localcdn.org';
// Updated mappings.js // Updated mappings.js
if (mappingUpdate) { if (mappingUpdate) {
storageManager.type.set({ items.lastMappingUpdate = mappings.lastMappingUpdate;
[Setting.LAST_MAPPING_UPDATE]: mappings.lastMappingUpdate storageManager.type.set(items);
});
} }
if ( (mappingUpdate && items.updateNotification == 1) || items.updateNotification == 2 ) { if ( (mappingUpdate && items.updateNotification == 1) || items.updateNotification == 2 ) {

View File

@ -25,7 +25,7 @@
New in LocalCDN: New in LocalCDN:
</div> </div>
<ul> <ul>
<li></li> <li>Fixed: Exported settings have old values (<a href="https://codeberg.org/nobody/LocalCDN/issues/177">#177</a>)</li>
</ul> </ul>
<div id="generator-section"> <div id="generator-section">
<div class="topic-label"> <div class="topic-label">