Merge branch 'master' of https://github.com/bitwarden/desktop into hotfix/multiple-extensions

This commit is contained in:
Hinton 2020-12-21 22:36:00 +01:00
commit 87d399a3f9
6 changed files with 58 additions and 14 deletions

2
package-lock.json generated
View File

@ -3638,7 +3638,7 @@
"dev": true
},
"duo_web_sdk": {
"version": "git+https://github.com/duosecurity/duo_web_sdk.git#410a9186cc34663c4913b17d6528067cd3331f1d",
"version": "git+https://github.com/duosecurity/duo_web_sdk.git#4c5df7a4001b8b03e2d7130d9096b697c4032e77",
"from": "git+https://github.com/duosecurity/duo_web_sdk.git"
},
"duplexer3": {

View File

@ -221,6 +221,7 @@
"artifactName": "${productName}-${version}-${arch}.${ext}"
},
"snap": {
"autoStart": true,
"confinement": "strict",
"plugs": [
"default",

View File

@ -54,6 +54,7 @@ export class SettingsComponent implements OnInit {
alwaysShowDock: boolean;
showAlwaysShowDock: boolean = false;
openAtLogin: boolean;
requireEnableTray: boolean = false;
enableTrayText: string;
enableTrayDescText: string;
@ -71,6 +72,9 @@ export class SettingsComponent implements OnInit {
private userService: UserService, private cryptoService: CryptoService) {
const isMac = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop;
// Workaround to avoid ghosting trays https://github.com/electron/electron/issues/17622
this.requireEnableTray = this.platformUtilsService.getDevice() === DeviceType.LinuxDesktop;
const trayKey = isMac ? 'enableMenuBar' : 'enableTray';
this.enableTrayText = this.i18nService.t(trayKey);
this.enableTrayDescText = this.i18nService.t(trayKey + 'Desc');
@ -271,17 +275,44 @@ export class SettingsComponent implements OnInit {
}
async saveCloseToTray() {
if (this.requireEnableTray) {
this.enableTray = true;
await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
}
await this.storageService.save(ElectronConstants.enableCloseToTrayKey, this.enableCloseToTray);
this.callAnalytics('CloseToTray', this.enableCloseToTray);
}
async saveTray() {
if (this.requireEnableTray && !this.enableTray && (this.startToTray || this.enableCloseToTray)) {
const confirm = await this.platformUtilsService.showDialog(
this.i18nService.t('confirmTrayDesc'), this.i18nService.t('confirmTrayTitle'),
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
if (confirm) {
this.startToTray = false;
await this.storageService.save(ElectronConstants.enableStartToTrayKey, this.startToTray);
this.enableCloseToTray = false;
await this.storageService.save(ElectronConstants.enableCloseToTrayKey, this.enableCloseToTray);
} else {
this.enableTray = true;
}
return;
}
await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
this.callAnalytics('Tray', this.enableTray);
this.messagingService.send(this.enableTray ? 'showTray' : 'removeTray');
}
async saveStartToTray() {
if (this.requireEnableTray) {
this.enableTray = true;
await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
}
await this.storageService.save(ElectronConstants.enableStartToTrayKey, this.startToTray);
this.callAnalytics('StartToTray', this.startToTray);
}

View File

@ -50,15 +50,16 @@
<i class="fa fa-plus fa-fw" aria-hidden="true"></i>
</button>
</div>
<ul class="fa-ul">
<ul>
<ng-template #recursiveFolders let-folders>
<li *ngFor="let f of folders"
[ngClass]="{active: selectedFolder && f.node.id === selectedFolderId}">
<a href="#" appStopClick appBlurClick (click)="selectFolder(f.node)">
<i *ngIf="f.children.length" class="fa-li fa" title="{{'toggleCollapse' | i18n}}" aria-hidden="true"
<i *ngIf="f.children.length" class="fa-fw fa" title="{{'toggleCollapse' | i18n}}" aria-hidden="true"
[ngClass]="{'fa-caret-right': isCollapsed(f.node), 'fa-caret-down': !isCollapsed(f.node)}"
(click)="collapse(f.node)" appStopProp></i>
{{f.node.name}}
<i *ngIf="f.children.length === 0" class="fa-fw fa fa-folder-o" aria-hidden="true"></i>
&nbsp;{{f.node.name}}
<span appStopProp appStopClick (click)="editFolder(f.node)" role="button"
appA11yTitle="{{'editFolder' | i18n}}" *ngIf="f.node.id">
<i class="fa fa-pencil fa-fw" aria-hidden="true"></i>
@ -74,14 +75,15 @@
</ul>
<div *ngIf="collections && collections.length">
<h2>{{'collections' | i18n}}</h2>
<ul class="fa-ul">
<ul>
<ng-template #recursiveCollections let-collections>
<li *ngFor="let c of collections" [ngClass]="{active: c.node.id === selectedCollectionId}">
<a href="#" appStopClick appBlurClick (click)="selectCollection(c.node)">
<i *ngIf="c.children.length" class="fa-li fa" title="{{'toggleCollapse' | i18n}}" aria-hidden="true"
<i *ngIf="c.children.length" class="fa-fw fa" title="{{'toggleCollapse' | i18n}}" aria-hidden="true"
[ngClass]="{'fa-caret-right': isCollapsed(c.node), 'fa-caret-down': !isCollapsed(c.node)}"
(click)="collapse(c.node)" appStopProp></i>
{{c.node.name}}
<i *ngIf="c.children.length === 0" class="fa-fw fa fa-cube" aria-hidden="true"></i>
&nbsp;{{c.node.name}}
</a>
<ul class="fa-ul" *ngIf="c.children.length && !isCollapsed(c.node)">
<ng-container

View File

@ -900,6 +900,12 @@
"alwaysShowDockDesc": {
"message": "Show the Bitwarden icon in the Dock even when minimized to the menu bar."
},
"confirmTrayTitle": {
"message": "Confirm disable tray"
},
"confirmTrayDesc": {
"message": "Disabling this setting will also disable all other tray related settings."
},
"language": {
"message": "Language"
},
@ -1476,5 +1482,8 @@
},
"personalOwnershipSubmitError": {
"message": "Due to an Enterprise Policy, you are restricted from saving items to your personal vault. Change the Ownership option to an organization and choose from available Collections."
},
"hintEqualsPassword": {
"message": "Your password hint cannot be the same as your password."
}
}

View File

@ -97,18 +97,19 @@ export class MessagingMain {
if (lockNowTrayMenuItem != null) {
lockNowTrayMenuItem.enabled = isAuthenticated && !isLocked;
}
this.main.trayMain.updateContextMenu();
}
private addOpenAtLogin() {
if (process.platform === 'linux') {
const data = `[Desktop Entry]
Type=Application
Version=${app.getVersion()}
Name=Bitwarden
Comment=Bitwarden startup script
Exec=${app.getPath('exe')}
StartupNotify=false
Terminal=false`;
Type=Application
Version=${app.getVersion()}
Name=Bitwarden
Comment=Bitwarden startup script
Exec=${app.getPath('exe')}
StartupNotify=false
Terminal=false`;
const dir = path.dirname(this.linuxStartupFile());
if (!fs.existsSync(dir)) {