1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +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?", "message": "What is the scope of the whitelisting?",
"description": "" "description": ""
}, },
"selectWhitelistType": {
"message": "What is the type of the whitelisting?",
"description": ""
},
"whitelistOnlyAPI": { "whitelistOnlyAPI": {
"message": "Whitelist only the {api}", "message": "Whitelist only the {api}",
"description": "" "description": ""

View File

@ -71,7 +71,7 @@
isIcon: true, isIcon: true,
callback: async function({domain, urls, api}){ callback: async function({domain, urls, api}){
const whitelistingSettings = { const whitelistingSettings = {
all: {name: "blockMode", value: "allowEverything"}, all: {name: "blockMode", value: "allowEverything", fakeValue: "fake"},
canvas: {name: "protectedCanvasPart", value: "nothing"}, canvas: {name: "protectedCanvasPart", value: "nothing"},
audio: {name: "protectAudio", value: false}, audio: {name: "protectAudio", value: false},
domRect: {name: "protectDOMRect", value: false}, domRect: {name: "protectDOMRect", value: false},
@ -110,6 +110,21 @@
)]; )];
} }
if (choice){ 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); await settings.set(setting.name, setting.value, choice);
} }

View File

@ -10,6 +10,7 @@ Version 1.6:
- try to not break tabs when updating - try to not break tabs when updating
- setting to postpone updates until browser restart or extension is reloaded - setting to postpone updates until browser restart or extension is reloaded
- added status button in browser action to see and set the whitelist status - 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: fixes:
- fix message canvasBlocker-unload - fix message canvasBlocker-unload