1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-28 12:35:40 +01:00

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 "dev": true
}, },
"duo_web_sdk": { "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" "from": "git+https://github.com/duosecurity/duo_web_sdk.git"
}, },
"duplexer3": { "duplexer3": {

View File

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

View File

@ -54,6 +54,7 @@ export class SettingsComponent implements OnInit {
alwaysShowDock: boolean; alwaysShowDock: boolean;
showAlwaysShowDock: boolean = false; showAlwaysShowDock: boolean = false;
openAtLogin: boolean; openAtLogin: boolean;
requireEnableTray: boolean = false;
enableTrayText: string; enableTrayText: string;
enableTrayDescText: string; enableTrayDescText: string;
@ -71,6 +72,9 @@ export class SettingsComponent implements OnInit {
private userService: UserService, private cryptoService: CryptoService) { private userService: UserService, private cryptoService: CryptoService) {
const isMac = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop; 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'; const trayKey = isMac ? 'enableMenuBar' : 'enableTray';
this.enableTrayText = this.i18nService.t(trayKey); this.enableTrayText = this.i18nService.t(trayKey);
this.enableTrayDescText = this.i18nService.t(trayKey + 'Desc'); this.enableTrayDescText = this.i18nService.t(trayKey + 'Desc');
@ -271,17 +275,44 @@ export class SettingsComponent implements OnInit {
} }
async saveCloseToTray() { async saveCloseToTray() {
if (this.requireEnableTray) {
this.enableTray = true;
await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
}
await this.storageService.save(ElectronConstants.enableCloseToTrayKey, this.enableCloseToTray); await this.storageService.save(ElectronConstants.enableCloseToTrayKey, this.enableCloseToTray);
this.callAnalytics('CloseToTray', this.enableCloseToTray); this.callAnalytics('CloseToTray', this.enableCloseToTray);
} }
async saveTray() { 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); await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
this.callAnalytics('Tray', this.enableTray); this.callAnalytics('Tray', this.enableTray);
this.messagingService.send(this.enableTray ? 'showTray' : 'removeTray'); this.messagingService.send(this.enableTray ? 'showTray' : 'removeTray');
} }
async saveStartToTray() { async saveStartToTray() {
if (this.requireEnableTray) {
this.enableTray = true;
await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray);
}
await this.storageService.save(ElectronConstants.enableStartToTrayKey, this.startToTray); await this.storageService.save(ElectronConstants.enableStartToTrayKey, this.startToTray);
this.callAnalytics('StartToTray', this.startToTray); this.callAnalytics('StartToTray', this.startToTray);
} }

View File

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

View File

@ -900,6 +900,12 @@
"alwaysShowDockDesc": { "alwaysShowDockDesc": {
"message": "Show the Bitwarden icon in the Dock even when minimized to the menu bar." "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": { "language": {
"message": "Language" "message": "Language"
}, },
@ -1476,5 +1482,8 @@
}, },
"personalOwnershipSubmitError": { "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." "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) { if (lockNowTrayMenuItem != null) {
lockNowTrayMenuItem.enabled = isAuthenticated && !isLocked; lockNowTrayMenuItem.enabled = isAuthenticated && !isLocked;
} }
this.main.trayMain.updateContextMenu();
} }
private addOpenAtLogin() { private addOpenAtLogin() {
if (process.platform === 'linux') { if (process.platform === 'linux') {
const data = `[Desktop Entry] const data = `[Desktop Entry]
Type=Application Type=Application
Version=${app.getVersion()} Version=${app.getVersion()}
Name=Bitwarden Name=Bitwarden
Comment=Bitwarden startup script Comment=Bitwarden startup script
Exec=${app.getPath('exe')} Exec=${app.getPath('exe')}
StartupNotify=false StartupNotify=false
Terminal=false`; Terminal=false`;
const dir = path.dirname(this.linuxStartupFile()); const dir = path.dirname(this.linuxStartupFile());
if (!fs.existsSync(dir)) { if (!fs.existsSync(dir)) {