mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 04:26:35 +02:00
Importing settings file with an older storage version did not work properly
This commit is contained in:
parent
85c88ad3d8
commit
b361733c73
2 changed files with 10 additions and 4 deletions
|
@ -110,10 +110,13 @@
|
|||
});
|
||||
input.click();
|
||||
});
|
||||
let json = JSON.parse(text);
|
||||
const json = JSON.parse(text);
|
||||
while (settingsMigration.transitions.hasOwnProperty(json.storageVersion)){
|
||||
let oldVersion = json.storageVersion;
|
||||
json = settingsMigration.transitions[json.storageVersion](json);
|
||||
const oldVersion = json.storageVersion;
|
||||
const modifiedData = settingsMigration.transitions[json.storageVersion](json);
|
||||
Object.keys(modifiedData).forEach(function(key){
|
||||
json[key] = modifiedData[key];
|
||||
});
|
||||
if (oldVersion === json.storageVersion){
|
||||
break;
|
||||
}
|
||||
|
@ -129,7 +132,9 @@
|
|||
}
|
||||
});
|
||||
keys.forEach(function(key){
|
||||
settings[key] = json[key];
|
||||
if (key !== "storageVersion"){
|
||||
settings[key] = json[key];
|
||||
}
|
||||
});
|
||||
},
|
||||
resetSettings: async function(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue