1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 04:40:20 +01:00

Add whitelist type selection

Fixes #538
This commit is contained in:
kkapsner 2021-06-08 23:42:19 +02:00
parent 3722263a6f
commit 43ea01c178
3 changed files with 21 additions and 1 deletions

View File

@ -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": ""

View File

@ -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);
}

View File

@ -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