mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
parent
2138467fd3
commit
fa92c15dab
7 changed files with 32 additions and 17 deletions
|
@ -530,7 +530,7 @@
|
|||
}
|
||||
|
||||
const settingsMigration = {
|
||||
validVersions: [undefined, 0.1, 0.2],
|
||||
validVersions: [undefined, 0.1, 0.2, 0.3, 0.4],
|
||||
transitions: {
|
||||
"": function(oldStorage){
|
||||
return {
|
||||
|
@ -600,7 +600,20 @@
|
|||
});
|
||||
|
||||
return newStorage;
|
||||
}
|
||||
},
|
||||
0.3: function(oldStorage){
|
||||
var newStorage = {
|
||||
storageVersion: 0.4
|
||||
};
|
||||
if (oldStorage.hasOwnProperty("apiWhiteList")){
|
||||
const protectedAPIFeatures = {};
|
||||
Object.keys(oldStorage.apiWhiteList).forEach(function(key){
|
||||
protectedAPIFeatures[key] = !oldStorage.apiWhiteList[key];
|
||||
});
|
||||
newStorage.protectedAPIFeatures = protectedAPIFeatures;
|
||||
}
|
||||
return newStorage;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -622,7 +635,9 @@
|
|||
else if (storage.storageVersion !== settings.storageVersion){
|
||||
var toChange = {};
|
||||
while (storage.storageVersion !== settings.storageVersion){
|
||||
logging.message("Old storage found. Storage version", storage.storageVersion);
|
||||
logging.message("Old storage found (",
|
||||
storage.storageVersion, "expected", settings.storageVersion,
|
||||
")");
|
||||
if (settingsMigration.transitions[storage.storageVersion]){
|
||||
var changes = settingsMigration.transitions[storage.storageVersion](storage);
|
||||
Object.entries(changes).forEach(function(entry){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue