Added notice when dom.webAudio.enabled is set to false

Fixes #592
This commit is contained in:
kkapsner 2022-01-30 17:50:59 +01:00
parent d4fc7027eb
commit 3d603b84d4
4 changed files with 38 additions and 23 deletions

View File

@ -100,6 +100,10 @@
"message": "You have privacy.resistFingerprinting enabled. This slightly changes the behaviour of CanvasBlocker. See further information {link:here:https://github.com/kkapsner/CanvasBlocker/issues/158} and {link:here:https://github.com/ghacksuserjs/ghacks-user.js/issues/767}.",
"description": ""
},
"settingsNotice.dom.webAudio.enabled": {
"message": "You have dom.webAudio.enabled disabled. This makes you more trackable as very few people do this.",
"description": ""
},
"openInTab": {
"message": "Open in separate tab",
"description": ""

View File

@ -37,7 +37,7 @@ header .bookmarkNotice .dontShowOptionsOnUpdate input {
vertical-align: sub;
}
.resistFingerprintingNotice {
.resistFingerprintingNotice, .settingsNotice {
margin: 0.5em 0;
padding: 0.5em;
border: 1px solid var(--input-error-background-color);

View File

@ -234,28 +234,38 @@
groupTabs.classList = "groupTabs";
document.body.appendChild(groupTabs);
if (
browser.privacy &&
browser.privacy.websites &&
browser.privacy.websites.resistFingerprinting &&
browser.privacy.websites.resistFingerprinting.get
){
browser.privacy.websites.resistFingerprinting.get({}).then(function({value}){
if (value){
const rfpNotice = document.createElement("div");
rfpNotice.className = "resistFingerprintingNotice";
rfpNotice.appendChild(
extension.parseTranslation(
extension.getTranslation("resistFingerprintingNotice")
)
);
document.body.insertBefore(rfpNotice, groupTabs);
}
return undefined;
}).catch(function(error){
logging.warning("Unable to read resistFingerprinting:", error);
});
}
[
{
check: async function(){
if (
browser.privacy &&
browser.privacy.websites &&
browser.privacy.websites.resistFingerprinting &&
browser.privacy.websites.resistFingerprinting.get
){
return (await browser.privacy.websites.resistFingerprinting.get({})).value;
}
return false;
},
className: "resistFingerprintingNotice",
text: "resistFingerprintingNotice"
},
{
check: () => !window.AudioContext,
text: "settingsNotice.dom.webAudio.enabled"
},
].forEach(async function(settingsCheck){
if (await settingsCheck.check()){
const settingsNotice = document.createElement("div");
settingsNotice.className = settingsCheck.className || "settingsNotice";
settingsNotice.appendChild(
extension.parseTranslation(
extension.getTranslation(settingsCheck.text)
)
);
document.body.insertBefore(settingsNotice, groupTabs);
}
});
const groups = document.createElement("ul");
groups.className = "groups";

View File

@ -4,6 +4,7 @@ Version 1.8:
new features:
- added SVG protection
- added notice when dom.webAudio.enabled is set to false
fixes:
- errors in URL regular expressions broke CB