From 3d603b84d48b17a07ec2e86c7c518127eff91b9f Mon Sep 17 00:00:00 2001 From: kkapsner Date: Sun, 30 Jan 2022 17:50:59 +0100 Subject: [PATCH] Added notice when dom.webAudio.enabled is set to false Fixes #592 --- _locales/en/messages.json | 4 +++ options/options.css | 2 +- options/options.js | 54 +++++++++++++++++++++++---------------- releaseNotes.txt | 1 + 4 files changed, 38 insertions(+), 23 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 0ceb0b7..6044a19 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -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": "" diff --git a/options/options.css b/options/options.css index 780aba3..8250bdf 100644 --- a/options/options.css +++ b/options/options.css @@ -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); diff --git a/options/options.js b/options/options.js index e0507a9..d3888c3 100644 --- a/options/options.js +++ b/options/options.js @@ -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"; diff --git a/releaseNotes.txt b/releaseNotes.txt index e585ad7..97bb9e7 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -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