Merge pull request #1570 from bitwarden/hotfix/biometric-ff
Remove nativeMessaging requirement from Firefox
This commit is contained in:
commit
1d79172876
12
gulpfile.js
12
gulpfile.js
|
@ -65,6 +65,7 @@ function dist(browserName, manifest) {
|
||||||
function distFirefox() {
|
function distFirefox() {
|
||||||
return dist('firefox', (manifest) => {
|
return dist('firefox', (manifest) => {
|
||||||
delete manifest.content_security_policy;
|
delete manifest.content_security_policy;
|
||||||
|
delete manifest.optional_permissions;
|
||||||
removeShortcuts(manifest);
|
removeShortcuts(manifest);
|
||||||
return manifest;
|
return manifest;
|
||||||
});
|
});
|
||||||
|
@ -75,7 +76,6 @@ function distOpera() {
|
||||||
delete manifest.applications;
|
delete manifest.applications;
|
||||||
delete manifest.content_security_policy;
|
delete manifest.content_security_policy;
|
||||||
removeShortcuts(manifest);
|
removeShortcuts(manifest);
|
||||||
moveNativeMessagingToOptional(manifest);
|
|
||||||
return manifest;
|
return manifest;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,6 @@ function distChrome() {
|
||||||
delete manifest.content_security_policy;
|
delete manifest.content_security_policy;
|
||||||
delete manifest.sidebar_action;
|
delete manifest.sidebar_action;
|
||||||
delete manifest.commands._execute_sidebar_action;
|
delete manifest.commands._execute_sidebar_action;
|
||||||
moveNativeMessagingToOptional(manifest);
|
|
||||||
return manifest;
|
return manifest;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -97,7 +96,6 @@ function distEdge() {
|
||||||
delete manifest.content_security_policy;
|
delete manifest.content_security_policy;
|
||||||
delete manifest.sidebar_action;
|
delete manifest.sidebar_action;
|
||||||
delete manifest.commands._execute_sidebar_action;
|
delete manifest.commands._execute_sidebar_action;
|
||||||
moveNativeMessagingToOptional(manifest);
|
|
||||||
return 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) {
|
function distSafariMas(cb) {
|
||||||
return distSafariApp(cb, 'mas');
|
return distSafariApp(cb, 'mas');
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,9 @@
|
||||||
"http://*/*",
|
"http://*/*",
|
||||||
"https://*/*",
|
"https://*/*",
|
||||||
"webRequest",
|
"webRequest",
|
||||||
"webRequestBlocking",
|
"webRequestBlocking"
|
||||||
|
],
|
||||||
|
"optional_permissions": [
|
||||||
"nativeMessaging"
|
"nativeMessaging"
|
||||||
],
|
],
|
||||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<label for="pin">{{'unlockWithPin' | i18n}}</label>
|
<label for="pin">{{'unlockWithPin' | i18n}}</label>
|
||||||
<input id="pin" type="checkbox" (change)="updatePin()" [(ngModel)]="pin">
|
<input id="pin" type="checkbox" (change)="updatePin()" [(ngModel)]="pin">
|
||||||
</div>
|
</div>
|
||||||
<div class="box-content-row box-content-row-checkbox" appBoxRow>
|
<div class="box-content-row box-content-row-checkbox" appBoxRow *ngIf="supportsBiometric">
|
||||||
<label for="biometric">{{'unlockWithBiometrics' | i18n}}</label>
|
<label for="biometric">{{'unlockWithBiometrics' | i18n}}</label>
|
||||||
<input id="biometric" type="checkbox" (change)="updateBiometric()" [(ngModel)]="biometric">
|
<input id="biometric" type="checkbox" (change)="updateBiometric()" [(ngModel)]="biometric">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -23,7 +23,6 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||||
import { UserService } from 'jslib/abstractions/user.service';
|
import { UserService } from 'jslib/abstractions/user.service';
|
||||||
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
|
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
|
||||||
import { resolve } from '@angular/compiler-cli/src/ngtsc/file_system';
|
|
||||||
|
|
||||||
const RateUrls = {
|
const RateUrls = {
|
||||||
[DeviceType.ChromeExtension]:
|
[DeviceType.ChromeExtension]:
|
||||||
|
@ -52,6 +51,7 @@ export class SettingsComponent implements OnInit {
|
||||||
vaultTimeoutActions: any[];
|
vaultTimeoutActions: any[];
|
||||||
vaultTimeoutAction: string;
|
vaultTimeoutAction: string;
|
||||||
pin: boolean = null;
|
pin: boolean = null;
|
||||||
|
supportsBiometric: boolean;
|
||||||
biometric: boolean = false;
|
biometric: boolean = false;
|
||||||
previousVaultTimeout: number = null;
|
previousVaultTimeout: number = null;
|
||||||
|
|
||||||
|
@ -102,6 +102,8 @@ export class SettingsComponent implements OnInit {
|
||||||
|
|
||||||
const pinSet = await this.vaultTimeoutService.isPinLockSet();
|
const pinSet = await this.vaultTimeoutService.isPinLockSet();
|
||||||
this.pin = pinSet[0] || pinSet[1];
|
this.pin = pinSet[0] || pinSet[1];
|
||||||
|
|
||||||
|
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
|
||||||
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
|
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,14 +210,12 @@ export class SettingsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateBiometric() {
|
async updateBiometric() {
|
||||||
if (this.biometric) {
|
if (this.biometric && this.supportsBiometric) {
|
||||||
|
|
||||||
// Request permission to use the optional permission for nativeMessaging
|
// Request permission to use the optional permission for nativeMessaging
|
||||||
if (!this.platformUtilsService.isFirefox()) {
|
if (!this.platformUtilsService.isFirefox()) {
|
||||||
const granted = await new Promise((resolve, reject) => {
|
const granted = await new Promise((resolve, reject) => {
|
||||||
chrome.permissions.request({permissions: ['nativeMessaging']}, function(granted) {
|
chrome.permissions.request({permissions: ['nativeMessaging']}, resolve);
|
||||||
resolve(granted);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!granted) {
|
if (!granted) {
|
||||||
|
|
|
@ -290,7 +290,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
||||||
}
|
}
|
||||||
|
|
||||||
supportsBiometric() {
|
supportsBiometric() {
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(!this.isFirefox() && !this.isSafari());
|
||||||
}
|
}
|
||||||
|
|
||||||
authenticateBiometric() {
|
authenticateBiometric() {
|
||||||
|
|
Loading…
Reference in New Issue