From 2f5d425f346f724056e45815dbd78eff4cf1911e Mon Sep 17 00:00:00 2001 From: ilyaigpetrov Date: Mon, 15 Jul 2024 23:40:31 +0500 Subject: [PATCH] Autoclose the consent screen after user choice. Show consent screen only in FireFox --- .../src/extension-common/00-init-apis.js | 6 ++++-- .../src/extension-common/pages/consent/index.js | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/00-init-apis.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/00-init-apis.js index 932c83c..640a71e 100644 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/00-init-apis.js +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/00-init-apis.js @@ -280,8 +280,10 @@ console.log('Extension started.'); const compareVersions = (a, b) => versionToInt(a) - versionToInt(b); + const ifFirefox = navigator.userAgent.toLowerCase().includes('firefox'); + let give; - const promise = new Promise((resolve) => { + const promise = !ifFirefox ? Promise.resolve() : new Promise((resolve) => { give = resolve; }); @@ -291,7 +293,7 @@ console.log('Extension started.'); give, }, platform: { - ifFirefox: navigator.userAgent.toLowerCase().includes('firefox'), + ifFirefox, }, version: { ifMini: false, diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/consent/index.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/consent/index.js index 343e3d7..b8fe6f6 100644 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/consent/index.js +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/consent/index.js @@ -3,8 +3,10 @@ chrome.runtime.getBackgroundPage( (backgroundPage) => backgroundPage.apis.errorHandlers.installListenersOn( window, 'CONSENT', () => { - agreeBtn.onclick = () => + agreeBtn.onclick = () => { backgroundPage.apis.consent.give(); + window.close(); + } rejectBtn.onclick = () => chrome.management.uninstallSelf(); },