This is an automated email from the git hooks/post-receive script.
shelikhoo pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 3bf4593379c27e39311787e45d389085b69a31a5 Author: WofWca wofwca@protonmail.com AuthorDate: Thu Aug 18 15:13:57 2022 +0300
fix: "run in background" not working if "enabled" was never toggled --- init-webext.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/init-webext.js b/init-webext.js index 003fb7f..3bbdfde 100644 --- a/init-webext.js +++ b/init-webext.js @@ -39,6 +39,10 @@ function maybeChangeBackgroundPermission(enabledSetting, runInBackgroundSetting) }); }
+// If you want to gonna change this to `false`, double-check everything as some code +// may still be assuming it to be `true`. +const DEFAULT_ENABLED = true; + class WebExtUI extends UI {
constructor() { @@ -152,7 +156,7 @@ class WebExtUI extends UI { // eslint-disable-next-line no-undef && SUPPORTS_WEBEXT_OPTIONAL_BACKGROUND_PERMISSION ) { - new Promise(r => chrome.storage.local.get({ "snowflake-enabled": false }, r)) + new Promise(r => chrome.storage.local.get({ "snowflake-enabled": DEFAULT_ENABLED }, r)) .then(storage => { maybeChangeBackgroundPermission(storage["snowflake-enabled"], m.runInBackground); }); @@ -202,7 +206,7 @@ class WebExtUI extends UI {
WebExtUI.prototype.port = null;
-WebExtUI.prototype.enabled = true; +WebExtUI.prototype.enabled = DEFAULT_ENABLED;
/* Entry point.