mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Enabled import of older storage versions.
This commit is contained in:
parent
5f74f13de3
commit
f565b8c32e
5 changed files with 29 additions and 2 deletions
|
@ -13,6 +13,7 @@
|
|||
const search = require("./search");
|
||||
const settingStrings = require("./settingStrings");
|
||||
const searchParameters = new URLSearchParams(window.location.search);
|
||||
const settingsMigration = require("./settingsMigration");
|
||||
|
||||
var callbacks = {
|
||||
openNavigatorSettings: function(){
|
||||
|
@ -75,6 +76,13 @@
|
|||
}).then(function(text){
|
||||
return JSON.parse(text);
|
||||
}).then(function(json){
|
||||
while (settingsMigration.transitions.hasOwnProperty(json.storageVersion)){
|
||||
let oldVersion = json.storageVersion;
|
||||
json = settingsMigration.transitions[json.storageVersion](json);
|
||||
if (oldVersion === json.storageVersion){
|
||||
break;
|
||||
}
|
||||
}
|
||||
const keys = Object.keys(json);
|
||||
keys.forEach(function(key){
|
||||
const setting = settings.getDefinition(key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue