From 43ea01c178ff6e5991ab0a0210e93e671650ec4c Mon Sep 17 00:00:00 2001 From: kkapsner Date: Tue, 8 Jun 2021 23:42:19 +0200 Subject: [PATCH] Add whitelist type selection Fixes #538 --- _locales/en/messages.json | 4 ++++ pageAction/pageAction.js | 17 ++++++++++++++++- releaseNotes.txt | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 84a6ad9..a7b4f15 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -849,6 +849,10 @@ "message": "What is the scope of the whitelisting?", "description": "" }, + "selectWhitelistType": { + "message": "What is the type of the whitelisting?", + "description": "" + }, "whitelistOnlyAPI": { "message": "Whitelist only the {api}", "description": "" diff --git a/pageAction/pageAction.js b/pageAction/pageAction.js index 3dde714..ad1b080 100644 --- a/pageAction/pageAction.js +++ b/pageAction/pageAction.js @@ -71,7 +71,7 @@ isIcon: true, callback: async function({domain, urls, api}){ const whitelistingSettings = { - all: {name: "blockMode", value: "allowEverything"}, + all: {name: "blockMode", value: "allowEverything", fakeValue: "fake"}, canvas: {name: "protectedCanvasPart", value: "nothing"}, audio: {name: "protectAudio", value: false}, domRect: {name: "protectDOMRect", value: false}, @@ -110,6 +110,21 @@ )]; } if (choice){ + if (setting === whitelistingSettings.all && settings.get(setting.name, choice).startsWith("block")){ + setting.value = await modalChoice( + extension.getTranslation("selectWhitelistType"), + [ + { + text: extension.getTranslation("blockMode_options." + setting.value), + value: setting.value + }, + { + text: extension.getTranslation("blockMode_options." + setting.fakeValue), + value: setting.fakeValue + } + ] + ); + } await settings.set(setting.name, setting.value, choice); } diff --git a/releaseNotes.txt b/releaseNotes.txt index df8b610..24a89b6 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -10,6 +10,7 @@ Version 1.6: - try to not break tabs when updating - setting to postpone updates until browser restart or extension is reloaded - added status button in browser action to see and set the whitelist status + - if the current block mode is set to blocking you can chose between faking and allowing if you whitelist an URL fixes: - fix message canvasBlocker-unload