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

Merge branch 'master' into soft-delete

This commit is contained in:
Chad Scharf 2020-05-08 09:26:43 -04:00
commit 151964f6b8
11 changed files with 85 additions and 14 deletions

2
jslib

@ -1 +1 @@
Subproject commit e9db844285e21525f5152e782063f04e02543553
Subproject commit 0092aac275e8efca66838a8c266eec1d455883aa

6
package-lock.json generated
View File

@ -846,9 +846,9 @@
}
},
"@types/lunr": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.1.6.tgz",
"integrity": "sha512-Bz6fUhX1llTa7ygQJN3ttoVkkrpW7xxSEP7D7OYFO/FCBKqKqruRUZtJzTtYA0GkQX13lxU5u+8LuCviJlAXkQ==",
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.3.3.tgz",
"integrity": "sha512-09sXZZVsB3Ib41U0fC+O1O+4UOZT1bl/e+/QubPxpqDWHNEchvx/DEb1KJMOwq6K3MTNzZFoNSzVdR++o1DVnw==",
"dev": true
},
"@types/node": {

View File

@ -35,12 +35,14 @@
"electron": "npm run build:main && concurrently -k -n Main,Rend -c yellow,cyan \"electron --inspect=5858 ./build --watch\" \"npm run build:renderer:watch\"",
"clean:dist": "rimraf ./dist/*",
"clean:l10n": "git push origin --delete l10n_master",
"pack:dir": "npm run clean:dist && electron-builder --dir -p never",
"pack:lin": "npm run clean:dist && electron-builder --linux --x64 -p never",
"pack:mac": "npm run clean:dist && electron-builder --mac -p never",
"pack:mac:mas": "npm run clean:dist && electron-builder --mac mas -p never",
"pack:mac:masdev": "npm run clean:dist && electron-builder --mac mas-dev -p never",
"pack:win": "npm run clean:dist && electron-builder --win --x64 --ia32 -p never -c.win.certificateSubjectName=\"8bit Solutions LLC\"",
"pack:win:ci": "npm run clean:dist && electron-builder --win --x64 --ia32 -p never",
"dist:dir": "npm run build && npm run pack:dir",
"dist:lin": "npm run build && npm run pack:lin",
"dist:mac": "npm run build && npm run pack:mac",
"dist:mac:mas": "npm run build && npm run pack:mac:mas",
@ -128,7 +130,12 @@
"rpm",
"AppImage",
"snap"
]
],
"desktop": {
"Name": "Bitwarden",
"Type": "Application",
"GenericName": "Password Manager"
}
},
"dmg": {
"icon": "dmg.icns",
@ -172,7 +179,7 @@
},
"appx": {
"artifactName": "${productName}-${version}-${arch}.${ext}",
"backgroundColor": "#3c8dbc",
"backgroundColor": "#175DDC",
"applicationId": "bitwardendesktop",
"identityName": "8bitSolutionsLLC.bitwardendesktop",
"publisher": "CN=14D52771-DE3C-4886-B8BF-825BA7690418",
@ -217,7 +224,7 @@
"devDependencies": {
"@angular/compiler-cli": "^7.2.11",
"@ngtools/webpack": "^7.2.2",
"@types/lunr": "^2.1.6",
"@types/lunr": "^2.3.3",
"@types/node-forge": "^0.7.5",
"@types/papaparse": "^4.5.3",
"@types/semver": "^5.5.0",

View File

@ -59,6 +59,17 @@
</select>
<small class="help-block">{{'clearClipboardDesc' | i18n}}</small>
</div>
<div class="form-group">
<div class="checkbox">
<label for="minimizeOnCopyToClipboard">
<input id="minimizeOnCopyToClipboard" type="checkbox"
name="MinimizeOnCopyToClipboard" [(ngModel)]="minimizeOnCopyToClipboard"
(change)="saveMinOnCopyToClipboard()">
{{'minimizeOnCopyToClipboard' | i18n}}
</label>
</div>
<small class="help-block">{{'minimizeOnCopyToClipboardDesc' | i18n}}</small>
</div>
<div class="form-group">
<div class="checkbox">
<label for="disableFavicons">

View File

@ -38,6 +38,7 @@ export class SettingsComponent implements OnInit {
enableTray: boolean = false;
showMinToTray: boolean = false;
startToTray: boolean = false;
minimizeOnCopyToClipboard: boolean = false;
locale: string;
vaultTimeouts: any[];
localeOptions: any[];
@ -122,9 +123,21 @@ export class SettingsComponent implements OnInit {
this.locale = await this.storageService.get<string>(ConstantsService.localeKey);
this.theme = await this.storageService.get<string>(ConstantsService.themeKey);
this.clearClipboard = await this.storageService.get<number>(ConstantsService.clearClipboardKey);
this.minimizeOnCopyToClipboard = await this.storageService.get<boolean>(
ElectronConstants.minimizeOnCopyToClipboardKey);
}
async saveVaultTimeoutOptions() {
if (this.vaultTimeoutAction === 'logOut') {
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('vaultTimeoutLogOutConfirmation'),
this.i18nService.t('vaultTimeoutLogOutConfirmationTitle'),
this.i18nService.t('yes'), this.i18nService.t('cancel'), 'warning');
if (!confirmed) {
this.vaultTimeoutAction = 'lock';
return;
}
}
await this.vaultTimeoutService.setVaultTimeoutOptions(this.vaultTimeout != null ? this.vaultTimeout : null,
this.vaultTimeoutAction);
}
@ -227,6 +240,11 @@ export class SettingsComponent implements OnInit {
window.setTimeout(() => window.location.reload(), 200);
}
async saveMinOnCopyToClipboard() {
await this.storageService.save(ElectronConstants.minimizeOnCopyToClipboardKey, this.minimizeOnCopyToClipboard);
this.callAnalytics('MinOnCopyToClipboard', this.minimizeOnCopyToClipboard);
}
async saveClearClipboard() {
await this.storageService.save(ConstantsService.clearClipboardKey, this.clearClipboard);
this.analytics.eventTrack.next({

View File

@ -684,6 +684,9 @@ export class VaultComponent implements OnInit, OnDestroy {
this.platformUtilsService.copyToClipboard(value);
this.toasterService.popAsync('info', null,
this.i18nService.t('valueCopied', this.i18nService.t(labelI18nKey)));
if (this.action === 'view') {
this.messagingService.send('minimizeOnCopy');
}
});
}

View File

@ -12,7 +12,9 @@ import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { EventService } from 'jslib/abstractions/event.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { TokenService } from 'jslib/abstractions/token.service';
import { TotpService } from 'jslib/abstractions/totp.service';
import { UserService } from 'jslib/abstractions/user.service';
@ -35,7 +37,8 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
cryptoService: CryptoService, platformUtilsService: PlatformUtilsService,
auditService: AuditService, broadcasterService: BroadcasterService,
ngZone: NgZone, changeDetectorRef: ChangeDetectorRef,
userService: UserService, eventService: EventService) {
userService: UserService, eventService: EventService,
private messagingService: MessagingService, private storageService: StorageService) {
super(cipherService, totpService, tokenService, i18nService, cryptoService, platformUtilsService,
auditService, window, broadcasterService, ngZone, changeDetectorRef, userService, eventService);
}
@ -48,4 +51,9 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
this.platformUtilsService.eventTrack('View Password History');
this.onViewCipherPasswordHistory.emit(this.cipher);
}
copy(value: string, typeI18nKey: string, aType: string) {
super.copy(value, typeI18nKey, aType);
this.messagingService.send('minimizeOnCopy');
}
}

View File

@ -112,6 +112,12 @@
"message": "Copy Value",
"description": "Copy value to clipboard"
},
"minimizeOnCopyToClipboard": {
"message": "Minimize when copying to clipboard"
},
"minimizeOnCopyToClipboardDesc": {
"message": "Minimize when copying an item's data to the clipboard."
},
"toggleVisibility": {
"message": "Toggle Visibility"
},
@ -1320,5 +1326,11 @@
},
"permanentlyDelete": {
"message": "Permanently Delete"
},
"vaultTimeoutLogOutConfirmation": {
"message": "Logging out will remove all access to your vault and requires online authentication after the timeout period. Are you sure you want to use this setting?"
},
"vaultTimeoutLogOutConfirmationTitle": {
"message": "Timeout Action Confirmation"
}
}

View File

@ -88,7 +88,7 @@ export class Main {
this.storageService = new ElectronStorageService(app.getPath('userData'), storageDefaults);
this.windowMain = new WindowMain(this.storageService, true);
this.messagingMain = new MessagingMain(this);
this.messagingMain = new MessagingMain(this, this.storageService);
this.updaterMain = new UpdaterMain(this.i18nService, this.windowMain, 'desktop', () => {
this.menuMain.updateMenuItem.enabled = false;
}, () => {

View File

@ -2,12 +2,16 @@ import { ipcMain } from 'electron';
import { Main } from '../main';
import { ElectronConstants } from 'jslib/electron/electronConstants';
import { StorageService } from 'jslib/abstractions/storage.service';
const SyncInterval = 5 * 60 * 1000; // 5 minutes
export class MessagingMain {
private syncTimeout: NodeJS.Timer;
constructor(private main: Main) { }
constructor(private main: Main, private storageService: StorageService) { }
init() {
this.scheduleNextSync();
@ -23,6 +27,14 @@ export class MessagingMain {
this.main.menuMain.updateApplicationMenuState(message.isAuthenticated, message.isLocked);
this.updateTrayMenu(message.isAuthenticated, message.isLocked);
break;
case 'minimizeOnCopy':
this.storageService.get<boolean>(ElectronConstants.minimizeOnCopyToClipboardKey).then(
(shouldMinimize) => {
if (shouldMinimize && this.main.windowMain.win != null) {
this.main.windowMain.win.minimize();
}
});
break;
case 'showTray':
this.main.trayMain.showTray();
break;

View File

@ -17,16 +17,16 @@ $gray: #555;
$gray-light: #777;
$text-muted: $gray-light;
$brand-primary: #3c8dbc;
$brand-primary: #175DDC;
$brand-danger: #dd4b39;
$brand-success: #00a65a;
$brand-info: #555555;
$brand-warning: #bf7e16;
$brand-primary-accent: #286090;
$brand-primary-accent: #1252A3;
$background-color: white;
$background-color-alt: #f9fafc;
$background-color-alt2: #ecf0f5;
$background-color-alt: #f9f9f9;
$background-color-alt2: #ededed;
$box-background-color: $background-color;
$box-background-hover-color: $list-item-hover;