From ab759a4746b4b694b4e5e7940c79c35baf7f1fb5 Mon Sep 17 00:00:00 2001 From: Hinton Date: Mon, 25 Jan 2021 21:23:18 +0100 Subject: [PATCH] Remove biometric from firefox --- gulpfile.js | 12 +----------- src/manifest.json | 4 +++- src/popup/settings/settings.component.html | 2 +- src/popup/settings/settings.component.ts | 5 ++++- src/services/browserPlatformUtils.service.ts | 2 +- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 541d4def69..5428873f59 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -65,6 +65,7 @@ function dist(browserName, manifest) { function distFirefox() { return dist('firefox', (manifest) => { delete manifest.content_security_policy; + delete manifest.optional_permissions; removeShortcuts(manifest); return manifest; }); @@ -75,7 +76,6 @@ function distOpera() { delete manifest.applications; delete manifest.content_security_policy; removeShortcuts(manifest); - moveNativeMessagingToOptional(manifest); return manifest; }); } @@ -86,7 +86,6 @@ function distChrome() { delete manifest.content_security_policy; delete manifest.sidebar_action; delete manifest.commands._execute_sidebar_action; - moveNativeMessagingToOptional(manifest); return manifest; }); } @@ -97,7 +96,6 @@ function distEdge() { delete manifest.content_security_policy; delete manifest.sidebar_action; delete manifest.commands._execute_sidebar_action; - moveNativeMessagingToOptional(manifest); return manifest; }); } @@ -111,14 +109,6 @@ function removeShortcuts(manifest) { } } -function moveNativeMessagingToOptional(manifest) { - const index = manifest.permissions.indexOf("nativeMessaging"); - index > -1 ? manifest.permissions.splice(index, 1) : false - manifest.optional_permissions = [ - "nativeMessaging" - ]; -} - function distSafariMas(cb) { return distSafariApp(cb, 'mas'); } diff --git a/src/manifest.json b/src/manifest.json index 42670dda10..3e50886648 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -89,7 +89,9 @@ "http://*/*", "https://*/*", "webRequest", - "webRequestBlocking", + "webRequestBlocking" + ], + "optional_permissions": [ "nativeMessaging" ], "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", diff --git a/src/popup/settings/settings.component.html b/src/popup/settings/settings.component.html index fc1eeedfe7..7a8558e816 100644 --- a/src/popup/settings/settings.component.html +++ b/src/popup/settings/settings.component.html @@ -42,7 +42,7 @@ -
+
diff --git a/src/popup/settings/settings.component.ts b/src/popup/settings/settings.component.ts index b61dedd9b2..c194e51d83 100644 --- a/src/popup/settings/settings.component.ts +++ b/src/popup/settings/settings.component.ts @@ -52,6 +52,7 @@ export class SettingsComponent implements OnInit { vaultTimeoutActions: any[]; vaultTimeoutAction: string; pin: boolean = null; + supportsBiometric: boolean; biometric: boolean = false; previousVaultTimeout: number = null; @@ -102,6 +103,8 @@ export class SettingsComponent implements OnInit { const pinSet = await this.vaultTimeoutService.isPinLockSet(); this.pin = pinSet[0] || pinSet[1]; + + this.supportsBiometric = await this.platformUtilsService.supportsBiometric(); this.biometric = await this.vaultTimeoutService.isBiometricLockSet(); } @@ -208,7 +211,7 @@ export class SettingsComponent implements OnInit { } async updateBiometric() { - if (this.biometric) { + if (this.biometric && this.supportsBiometric) { // Request permission to use the optional permission for nativeMessaging if (!this.platformUtilsService.isFirefox()) { diff --git a/src/services/browserPlatformUtils.service.ts b/src/services/browserPlatformUtils.service.ts index 38bab53b43..7f9835cd1e 100644 --- a/src/services/browserPlatformUtils.service.ts +++ b/src/services/browserPlatformUtils.service.ts @@ -290,7 +290,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService } supportsBiometric() { - return Promise.resolve(true); + return Promise.resolve(!this.isFirefox() && !this.isSafari()); } authenticateBiometric() {