diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 8285cc2..47d022c 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -502,12 +502,12 @@ "description": "" }, - "apiWhiteList_title": { - "message": "API Whitelist", + "protectedAPIFeatures_title": { + "message": "Geschützte API Funktionen", "description": "" }, - "apiWhiteList_description": { - "message": "Erlaubt ausgewählte Teile der APIs. Wenn eine der Boxen markiert wird, wird dieser Teil der API nicht geschützt.", + "protectedAPIFeatures_description": { + "message": "Liste der geschützten Funktionen der APIs. Wenn eine der Boxen demarkiert wird, wird dieser Teil der API nicht geschützt.", "description": "" }, diff --git a/_locales/en/messages.json b/_locales/en/messages.json index b9ccf6b..0621c11 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -502,12 +502,12 @@ "description": "" }, - "apiWhiteList_title": { - "message": "API whitelist", + "protectedAPIFeatures_title": { + "message": "Protected API features", "description": "" }, - "apiWhiteList_description": { - "message": "Allows certain parts of the APIs. When ticking a checkbox this feature of the API will not be protected.", + "protectedAPIFeatures_description": { + "message": "List of protected API features. When unticking a checkbox this feature of the API will not be protected.", "description": "" }, diff --git a/lib/intercept.js b/lib/intercept.js index 5d31371..1e37ffa 100644 --- a/lib/intercept.js +++ b/lib/intercept.js @@ -234,7 +234,7 @@ }); } - if (funcStatus.active && !prefs("apiWhiteList")[name]){ + if (funcStatus.active && prefs("protectedAPIFeatures")[name]){ if (funcStatus.mode === "ask"){ funcStatus.mode = ask({ window: window, diff --git a/lib/settingDefinitions.js b/lib/settingDefinitions.js index 7ee596d..5fc80b1 100644 --- a/lib/settingDefinitions.js +++ b/lib/settingDefinitions.js @@ -74,7 +74,7 @@ options: ["white", "nonPersistent", "constant", "persistent"] }, { - name: "apiWhiteList", + name: "protectedAPIFeatures", defaultValue: {}, keys: [ {name: "Canvas-API", level: 1}, @@ -105,7 +105,7 @@ "boundingClientRect", "rootBounds", ], - defaultKeyValue: false + defaultKeyValue: true }, { name: "useCanvasCache", @@ -298,7 +298,7 @@ }, { name: "storageVersion", - defaultValue: 0.3, + defaultValue: 0.4, fixed: true } ]; diff --git a/lib/settings.js b/lib/settings.js index 8a86db7..b6ce52f 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -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){ diff --git a/options/settingsDisplay.js b/options/settingsDisplay.js index 5f592ce..e5fa469 100644 --- a/options/settingsDisplay.js +++ b/options/settingsDisplay.js @@ -184,7 +184,7 @@ ] }, { - "name": "apiWhiteList", + "name": "protectedAPIFeatures", "displayDependencies": [ { "displayAdvancedSettings": [true] diff --git a/releaseNotes.txt b/releaseNotes.txt index 2ba8279..6489f34 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -1,6 +1,6 @@ Version 0.5.4: changes: - - + - converted "API whitelist" to "protected API features" (automatic settings migration) new features: - added save/load directly to/from file option