mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-30 12:54:31 +01:00
Match linter rules
This commit is contained in:
parent
62a43e536c
commit
e76e56d824
@ -26,8 +26,8 @@
|
|||||||
"symlink:win": "rm -rf ./jslib && cmd /c mklink /J .\\jslib ..\\jslib",
|
"symlink:win": "rm -rf ./jslib && cmd /c mklink /J .\\jslib ..\\jslib",
|
||||||
"symlink:mac": "npm run symlink:lin",
|
"symlink:mac": "npm run symlink:lin",
|
||||||
"symlink:lin": "rm -rf ./jslib && ln -s ../jslib ./jslib",
|
"symlink:lin": "rm -rf ./jslib && ln -s ../jslib ./jslib",
|
||||||
"lint": "tslint src/**/*.ts",
|
"lint": "tslint 'src/**/*.ts'",
|
||||||
"lint:fix": "tslint src/**/*.ts --fix",
|
"lint:fix": "tslint 'src/**/*.ts' --fix",
|
||||||
"build": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\"",
|
"build": "concurrently -n Main,Rend -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\"",
|
||||||
"build:main": "webpack --config webpack.main.js",
|
"build:main": "webpack --config webpack.main.js",
|
||||||
"build:renderer": "gulp prebuild:renderer && webpack --config webpack.renderer.js",
|
"build:renderer": "gulp prebuild:renderer && webpack --config webpack.renderer.js",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnDestroy,
|
|
||||||
NgZone,
|
NgZone,
|
||||||
|
OnDestroy,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
ActivatedRoute,
|
ActivatedRoute,
|
||||||
@ -43,7 +43,7 @@ export class LockComponent extends BaseLockComponent implements OnDestroy {
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
this.route.queryParams.subscribe((params) => {
|
this.route.queryParams.subscribe(params => {
|
||||||
if (this.supportsBiometric && params.promptBiometric) {
|
if (this.supportsBiometric && params.promptBiometric) {
|
||||||
setTimeout(() => this.unlockBiometric(), 1000);
|
setTimeout(() => this.unlockBiometric(), 1000);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
ComponentFactoryResolver,
|
ComponentFactoryResolver,
|
||||||
OnDestroy,
|
|
||||||
NgZone,
|
NgZone,
|
||||||
|
OnDestroy,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
ViewContainerRef,
|
ViewContainerRef,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
NgZone,
|
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnDestroy,
|
|
||||||
NgZone,
|
NgZone,
|
||||||
|
OnDestroy,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -22,8 +22,8 @@ import { ConstantsService } from 'jslib/services/constants.service';
|
|||||||
|
|
||||||
import { ElectronConstants } from 'jslib/electron/electronConstants';
|
import { ElectronConstants } from 'jslib/electron/electronConstants';
|
||||||
|
|
||||||
import { Utils } from 'jslib/misc/utils';
|
|
||||||
import { isWindowsStore } from 'jslib/electron/utils';
|
import { isWindowsStore } from 'jslib/electron/utils';
|
||||||
|
import { Utils } from 'jslib/misc/utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-settings',
|
selector: 'app-settings',
|
||||||
@ -81,15 +81,15 @@ export class SettingsComponent implements OnInit {
|
|||||||
this.enableTrayDescText = this.i18nService.t(trayKey + 'Desc');
|
this.enableTrayDescText = this.i18nService.t(trayKey + 'Desc');
|
||||||
|
|
||||||
const minToTrayKey = isMac ? 'enableMinToMenuBar' : 'enableMinToTray';
|
const minToTrayKey = isMac ? 'enableMinToMenuBar' : 'enableMinToTray';
|
||||||
this.enableMinToTrayText = this.i18nService.t(minToTrayKey)
|
this.enableMinToTrayText = this.i18nService.t(minToTrayKey);
|
||||||
this.enableMinToTrayDescText = this.i18nService.t(minToTrayKey + 'Desc');
|
this.enableMinToTrayDescText = this.i18nService.t(minToTrayKey + 'Desc');
|
||||||
|
|
||||||
const closeToTrayKey = isMac ? 'enableCloseToMenuBar' : 'enableCloseToTray';
|
const closeToTrayKey = isMac ? 'enableCloseToMenuBar' : 'enableCloseToTray';
|
||||||
this.enableCloseToTrayText = this.i18nService.t(closeToTrayKey)
|
this.enableCloseToTrayText = this.i18nService.t(closeToTrayKey);
|
||||||
this.enableCloseToTrayDescText = this.i18nService.t(closeToTrayKey + 'Desc');
|
this.enableCloseToTrayDescText = this.i18nService.t(closeToTrayKey + 'Desc');
|
||||||
|
|
||||||
const startToTrayKey = isMac ? 'startToMenuBar' : 'startToTray';
|
const startToTrayKey = isMac ? 'startToMenuBar' : 'startToTray';
|
||||||
this.startToTrayText = this.i18nService.t(startToTrayKey)
|
this.startToTrayText = this.i18nService.t(startToTrayKey);
|
||||||
this.startToTrayDescText = this.i18nService.t(startToTrayKey + 'Desc');
|
this.startToTrayDescText = this.i18nService.t(startToTrayKey + 'Desc');
|
||||||
|
|
||||||
this.vaultTimeouts = [
|
this.vaultTimeouts = [
|
||||||
@ -114,7 +114,7 @@ export class SettingsComponent implements OnInit {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const localeOptions: any[] = [];
|
const localeOptions: any[] = [];
|
||||||
i18nService.supportedTranslationLocales.forEach((locale) => {
|
i18nService.supportedTranslationLocales.forEach(locale => {
|
||||||
let name = locale;
|
let name = locale;
|
||||||
if (i18nService.localeNames.has(locale)) {
|
if (i18nService.localeNames.has(locale)) {
|
||||||
name += (' - ' + i18nService.localeNames.get(locale));
|
name += (' - ' + i18nService.localeNames.get(locale));
|
||||||
|
@ -90,8 +90,8 @@ import localePtBr from '@angular/common/locales/pt';
|
|||||||
import localePtPt from '@angular/common/locales/pt-PT';
|
import localePtPt from '@angular/common/locales/pt-PT';
|
||||||
import localeRo from '@angular/common/locales/ro';
|
import localeRo from '@angular/common/locales/ro';
|
||||||
import localeRu from '@angular/common/locales/ru';
|
import localeRu from '@angular/common/locales/ru';
|
||||||
import localeSr from '@angular/common/locales/sr';
|
|
||||||
import localeSk from '@angular/common/locales/sk';
|
import localeSk from '@angular/common/locales/sk';
|
||||||
|
import localeSr from '@angular/common/locales/sr';
|
||||||
import localeSv from '@angular/common/locales/sv';
|
import localeSv from '@angular/common/locales/sv';
|
||||||
import localeTh from '@angular/common/locales/th';
|
import localeTh from '@angular/common/locales/th';
|
||||||
import localeTr from '@angular/common/locales/tr';
|
import localeTr from '@angular/common/locales/tr';
|
||||||
|
@ -15,5 +15,5 @@ if (!isDev()) {
|
|||||||
platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true });
|
platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true });
|
||||||
|
|
||||||
// Disable drag and drop to prevent malicious links from executing in the context of the app
|
// Disable drag and drop to prevent malicious links from executing in the context of the app
|
||||||
document.addEventListener('dragover', (event) => event.preventDefault());
|
document.addEventListener('dragover', event => event.preventDefault());
|
||||||
document.addEventListener('drop', (event) => event.preventDefault());
|
document.addEventListener('drop', event => event.preventDefault());
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
NgZone,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
NgZone,
|
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { AuditService } from 'jslib/abstractions/audit.service';
|
import { AuditService } from 'jslib/abstractions/audit.service';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
NgZone,
|
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
||||||
|
@ -194,7 +194,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
|
const queryParamsSub = this.route.queryParams.subscribe(async params => {
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
this.modal = this.attachmentsModalRef.createComponent(factory).instance;
|
this.modal = this.attachmentsModalRef.createComponent(factory).instance;
|
||||||
const childComponent = this.modal.show<AttachmentsComponent>(AttachmentsComponent, this.attachmentsModalRef,
|
const childComponent = this.modal.show<AttachmentsComponent>(AttachmentsComponent, this.attachmentsModalRef,
|
||||||
true, (comp) => comp.cipherId = cipher.id);
|
true, comp => comp.cipherId = cipher.id);
|
||||||
let madeAttachmentChanges = false;
|
let madeAttachmentChanges = false;
|
||||||
childComponent.onUploadedAttachment.subscribe(() => madeAttachmentChanges = true);
|
childComponent.onUploadedAttachment.subscribe(() => madeAttachmentChanges = true);
|
||||||
childComponent.onDeletedAttachment.subscribe(() => madeAttachmentChanges = true);
|
childComponent.onDeletedAttachment.subscribe(() => madeAttachmentChanges = true);
|
||||||
@ -445,7 +445,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
this.modal = this.shareModalRef.createComponent(factory).instance;
|
this.modal = this.shareModalRef.createComponent(factory).instance;
|
||||||
const childComponent = this.modal.show<ShareComponent>(ShareComponent, this.shareModalRef, true,
|
const childComponent = this.modal.show<ShareComponent>(ShareComponent, this.shareModalRef, true,
|
||||||
(comp) => comp.cipherId = cipher.id);
|
comp => comp.cipherId = cipher.id);
|
||||||
|
|
||||||
childComponent.onSharedCipher.subscribe(async () => {
|
childComponent.onSharedCipher.subscribe(async () => {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
@ -465,7 +465,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
this.modal = this.collectionsModalRef.createComponent(factory).instance;
|
this.modal = this.collectionsModalRef.createComponent(factory).instance;
|
||||||
const childComponent = this.modal.show<CollectionsComponent>(CollectionsComponent, this.collectionsModalRef,
|
const childComponent = this.modal.show<CollectionsComponent>(CollectionsComponent, this.collectionsModalRef,
|
||||||
true, (comp) => comp.cipherId = cipher.id);
|
true, comp => comp.cipherId = cipher.id);
|
||||||
|
|
||||||
childComponent.onSavedCollections.subscribe(() => {
|
childComponent.onSavedCollections.subscribe(() => {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
@ -484,7 +484,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
this.modal = this.passwordHistoryModalRef.createComponent(factory).instance;
|
this.modal = this.passwordHistoryModalRef.createComponent(factory).instance;
|
||||||
this.modal.show<PasswordHistoryComponent>(PasswordHistoryComponent,
|
this.modal.show<PasswordHistoryComponent>(PasswordHistoryComponent,
|
||||||
this.passwordHistoryModalRef, true, (comp) => comp.cipherId = cipher.id);
|
this.passwordHistoryModalRef, true, comp => comp.cipherId = cipher.id);
|
||||||
this.modal.onClosed.subscribe(async () => {
|
this.modal.onClosed.subscribe(async () => {
|
||||||
this.modal = null;
|
this.modal = null;
|
||||||
});
|
});
|
||||||
@ -505,7 +505,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
async filterFavorites() {
|
async filterFavorites() {
|
||||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFavorites');
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFavorites');
|
||||||
await this.ciphersComponent.reload((c) => c.favorite);
|
await this.ciphersComponent.reload(c => c.favorite);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.favorites = true;
|
this.favorites = true;
|
||||||
this.go();
|
this.go();
|
||||||
@ -522,7 +522,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
async filterCipherType(type: CipherType) {
|
async filterCipherType(type: CipherType) {
|
||||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchType');
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchType');
|
||||||
await this.ciphersComponent.reload((c) => c.type === type);
|
await this.ciphersComponent.reload(c => c.type === type);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.go();
|
this.go();
|
||||||
@ -531,7 +531,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
async filterFolder(folderId: string) {
|
async filterFolder(folderId: string) {
|
||||||
folderId = folderId === 'none' ? null : folderId;
|
folderId = folderId === 'none' ? null : folderId;
|
||||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFolder');
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchFolder');
|
||||||
await this.ciphersComponent.reload((c) => c.folderId === folderId);
|
await this.ciphersComponent.reload(c => c.folderId === folderId);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.folderId = folderId == null ? 'none' : folderId;
|
this.folderId = folderId == null ? 'none' : folderId;
|
||||||
this.go();
|
this.go();
|
||||||
@ -539,7 +539,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
async filterCollection(collectionId: string) {
|
async filterCollection(collectionId: string) {
|
||||||
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchCollection');
|
this.ciphersComponent.searchPlaceholder = this.i18nService.t('searchCollection');
|
||||||
await this.ciphersComponent.reload((c) => c.collectionIds != null &&
|
await this.ciphersComponent.reload(c => c.collectionIds != null &&
|
||||||
c.collectionIds.indexOf(collectionId) > -1);
|
c.collectionIds.indexOf(collectionId) > -1);
|
||||||
this.clearFilters();
|
this.clearFilters();
|
||||||
this.collectionId = collectionId;
|
this.collectionId = collectionId;
|
||||||
@ -555,7 +555,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
this.modal = this.passwordGeneratorModalRef.createComponent(factory).instance;
|
this.modal = this.passwordGeneratorModalRef.createComponent(factory).instance;
|
||||||
const childComponent = this.modal.show<PasswordGeneratorComponent>(PasswordGeneratorComponent,
|
const childComponent = this.modal.show<PasswordGeneratorComponent>(PasswordGeneratorComponent,
|
||||||
this.passwordGeneratorModalRef, true, (comp) => comp.showSelect = showSelect);
|
this.passwordGeneratorModalRef, true, comp => comp.showSelect = showSelect);
|
||||||
|
|
||||||
childComponent.onSelected.subscribe((password: string) => {
|
childComponent.onSelected.subscribe((password: string) => {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
@ -596,7 +596,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
|
this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
|
||||||
const childComponent = this.modal.show<FolderAddEditComponent>(
|
const childComponent = this.modal.show<FolderAddEditComponent>(
|
||||||
FolderAddEditComponent, this.folderAddEditModalRef, true, (comp) => comp.folderId = null);
|
FolderAddEditComponent, this.folderAddEditModalRef, true, comp => comp.folderId = null);
|
||||||
|
|
||||||
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
|
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
@ -616,7 +616,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
|
this.modal = this.folderAddEditModalRef.createComponent(factory).instance;
|
||||||
const childComponent = this.modal.show<FolderAddEditComponent>(
|
const childComponent = this.modal.show<FolderAddEditComponent>(
|
||||||
FolderAddEditComponent, this.folderAddEditModalRef, true, (comp) => comp.folderId = folderId);
|
FolderAddEditComponent, this.folderAddEditModalRef, true, comp => comp.folderId = folderId);
|
||||||
|
|
||||||
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
|
childComponent.onSavedFolder.subscribe(async (folder: FolderView) => {
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
@ -699,7 +699,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private updateCollectionProperties() {
|
private updateCollectionProperties() {
|
||||||
if (this.collectionId != null) {
|
if (this.collectionId != null) {
|
||||||
const collection = this.groupingsComponent.collections.filter((c) => c.id === this.collectionId);
|
const collection = this.groupingsComponent.collections.filter(c => c.id === this.collectionId);
|
||||||
if (collection.length > 0) {
|
if (collection.length > 0) {
|
||||||
this.addOrganizationId = collection[0].organizationId;
|
this.addOrganizationId = collection[0].organizationId;
|
||||||
this.addCollectionIds = [this.collectionId];
|
this.addCollectionIds = [this.collectionId];
|
||||||
|
@ -16,7 +16,7 @@ if (process.argv.some(arg => arg.indexOf('chrome-extension://') !== -1 || arg.in
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
process.stdout.on('error', (e) => {
|
process.stdout.on('error', e => {
|
||||||
if (e.code === 'EPIPE') {
|
if (e.code === 'EPIPE') {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ export class Main {
|
|||||||
app.setPath('logs', path.join(app.getPath('userData'), 'logs'));
|
app.setPath('logs', path.join(app.getPath('userData'), 'logs'));
|
||||||
|
|
||||||
const args = process.argv.slice(1);
|
const args = process.argv.slice(1);
|
||||||
const watch = args.some((val) => val === '--watch');
|
const watch = args.some(val => val === '--watch');
|
||||||
|
|
||||||
if (watch) {
|
if (watch) {
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
@ -92,7 +92,7 @@ export class Main {
|
|||||||
this.storageService = new ElectronStorageService(app.getPath('userData'), storageDefaults);
|
this.storageService = new ElectronStorageService(app.getPath('userData'), storageDefaults);
|
||||||
|
|
||||||
this.windowMain = new WindowMain(this.storageService, true, undefined, undefined,
|
this.windowMain = new WindowMain(this.storageService, true, undefined, undefined,
|
||||||
(arg) => this.processDeepLink(arg), (win) => this.trayMain.setupWindowListeners(win));
|
arg => this.processDeepLink(arg), win => this.trayMain.setupWindowListeners(win));
|
||||||
this.messagingMain = new MessagingMain(this, this.storageService);
|
this.messagingMain = new MessagingMain(this, this.storageService);
|
||||||
this.updaterMain = new UpdaterMain(this.i18nService, this.windowMain, 'desktop', () => {
|
this.updaterMain = new UpdaterMain(this.i18nService, this.windowMain, 'desktop', () => {
|
||||||
this.menuMain.updateMenuItem.enabled = false;
|
this.menuMain.updateMenuItem.enabled = false;
|
||||||
@ -105,7 +105,7 @@ export class Main {
|
|||||||
this.powerMonitorMain = new PowerMonitorMain(this);
|
this.powerMonitorMain = new PowerMonitorMain(this);
|
||||||
this.trayMain = new TrayMain(this.windowMain, this.i18nService, this.storageService);
|
this.trayMain = new TrayMain(this.windowMain, this.i18nService, this.storageService);
|
||||||
|
|
||||||
this.messagingService = new ElectronMainMessagingService(this.windowMain, (message) => {
|
this.messagingService = new ElectronMainMessagingService(this.windowMain, message => {
|
||||||
this.messagingMain.onMessage(message);
|
this.messagingMain.onMessage(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ export class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private processDeepLink(argv: string[]): void {
|
private processDeepLink(argv: string[]): void {
|
||||||
argv.filter((s) => s.indexOf('bitwarden://') === 0).forEach((s) => {
|
argv.filter(s => s.indexOf('bitwarden://') === 0).forEach(s => {
|
||||||
const url = new URL(s);
|
const url = new URL(s);
|
||||||
const code = url.searchParams.get('code');
|
const code = url.searchParams.get('code');
|
||||||
const receivedState = url.searchParams.get('state');
|
const receivedState = url.searchParams.get('state');
|
||||||
|
@ -37,7 +37,7 @@ export class MessagingMain {
|
|||||||
break;
|
break;
|
||||||
case 'minimizeOnCopy':
|
case 'minimizeOnCopy':
|
||||||
this.storageService.get<boolean>(ElectronConstants.minimizeOnCopyToClipboardKey).then(
|
this.storageService.get<boolean>(ElectronConstants.minimizeOnCopyToClipboardKey).then(
|
||||||
(shouldMinimize) => {
|
shouldMinimize => {
|
||||||
if (shouldMinimize && this.main.windowMain.win !== null) {
|
if (shouldMinimize && this.main.windowMain.win !== null) {
|
||||||
this.main.windowMain.win.minimize();
|
this.main.windowMain.win.minimize();
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { promises as fs, existsSync } from 'fs';
|
import { existsSync, promises as fs } from 'fs';
|
||||||
import * as ipc from 'node-ipc';
|
import * as ipc from 'node-ipc';
|
||||||
|
import { homedir, userInfo } from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
import { homedir, userInfo } from 'os';
|
|
||||||
|
|
||||||
import { LogService } from 'jslib/abstractions/log.service';
|
|
||||||
import { ipcMain } from 'electron';
|
import { ipcMain } from 'electron';
|
||||||
|
import { LogService } from 'jslib/abstractions/log.service';
|
||||||
import { WindowMain } from 'jslib/electron/window.main';
|
import { WindowMain } from 'jslib/electron/window.main';
|
||||||
|
|
||||||
export class NativeMessagingMain {
|
export class NativeMessagingMain {
|
||||||
@ -31,11 +31,11 @@ export class NativeMessagingMain {
|
|||||||
if (this.socket != null && msg != null) {
|
if (this.socket != null && msg != null) {
|
||||||
this.send(msg, this.socket);
|
this.send(msg, this.socket);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
ipc.server.on('connect', () => {
|
ipc.server.on('connect', () => {
|
||||||
this.connected = true;
|
this.connected = true;
|
||||||
})
|
});
|
||||||
|
|
||||||
ipc.server.on(
|
ipc.server.on(
|
||||||
'socket.disconnected',
|
'socket.disconnected',
|
||||||
@ -66,7 +66,7 @@ export class NativeMessagingMain {
|
|||||||
'description': 'Bitwarden desktop <-> browser bridge',
|
'description': 'Bitwarden desktop <-> browser bridge',
|
||||||
'path': this.binaryPath(),
|
'path': this.binaryPath(),
|
||||||
'type': 'stdio',
|
'type': 'stdio',
|
||||||
}
|
};
|
||||||
|
|
||||||
const firefoxJson = {...baseJson, ...{ 'allowed_extensions': ['{446900e4-71c2-419f-a6a7-df9c091e268b}']}};
|
const firefoxJson = {...baseJson, ...{ 'allowed_extensions': ['{446900e4-71c2-419f-a6a7-df9c091e268b}']}};
|
||||||
const chromeJson = {...baseJson, ...{
|
const chromeJson = {...baseJson, ...{
|
||||||
@ -168,11 +168,11 @@ export class NativeMessagingMain {
|
|||||||
const createKey = util.promisify(regedit.createKey);
|
const createKey = util.promisify(regedit.createKey);
|
||||||
const putValue = util.promisify(regedit.putValue);
|
const putValue = util.promisify(regedit.putValue);
|
||||||
|
|
||||||
this.logService.debug(`Adding registry: ${location}`)
|
this.logService.debug(`Adding registry: ${location}`);
|
||||||
|
|
||||||
// Check installed
|
// Check installed
|
||||||
try {
|
try {
|
||||||
await list(check)
|
await list(check);
|
||||||
} catch {
|
} catch {
|
||||||
this.logService.warning(`Not finding registry ${check} skipping.`);
|
this.logService.warning(`Not finding registry ${check} skipping.`);
|
||||||
return;
|
return;
|
||||||
@ -188,7 +188,7 @@ export class NativeMessagingMain {
|
|||||||
value: jsonFile,
|
value: jsonFile,
|
||||||
type: 'REG_DEFAULT',
|
type: 'REG_DEFAULT',
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
return putValue(obj);
|
return putValue(obj);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -202,7 +202,7 @@ export class NativeMessagingMain {
|
|||||||
const list = util.promisify(regedit.list);
|
const list = util.promisify(regedit.list);
|
||||||
const deleteKey = util.promisify(regedit.deleteKey);
|
const deleteKey = util.promisify(regedit.deleteKey);
|
||||||
|
|
||||||
this.logService.debug(`Removing registry: ${key}`)
|
this.logService.debug(`Removing registry: ${key}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await list(key);
|
await list(key);
|
||||||
|
@ -10,7 +10,7 @@ if (process.platform === 'darwin') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default class IPC {
|
export default class IPC {
|
||||||
onMessage: (message: object) => void
|
onMessage: (message: object) => void;
|
||||||
|
|
||||||
private connected = false;
|
private connected = false;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ export default class IPC {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Notify browser extension, connection is established to desktop application.
|
// Notify browser extension, connection is established to desktop application.
|
||||||
this.onMessage({command: 'connected'})
|
this.onMessage({command: 'connected'});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.of.bitwarden.on('disconnect', () => {
|
ipc.of.bitwarden.on('disconnect', () => {
|
||||||
@ -32,7 +32,7 @@ export default class IPC {
|
|||||||
console.error('disconnected from world');
|
console.error('disconnected from world');
|
||||||
|
|
||||||
// Notify browser extension, no connection to desktop application.
|
// Notify browser extension, no connection to desktop application.
|
||||||
this.onMessage({command: 'disconnected'})
|
this.onMessage({command: 'disconnected'});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.of.bitwarden.on('message', (message: any) => {
|
ipc.of.bitwarden.on('message', (message: any) => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import NativeMessage from './nativemessage';
|
|
||||||
import IPC from './ipc';
|
import IPC from './ipc';
|
||||||
|
import NativeMessage from './nativemessage';
|
||||||
|
|
||||||
// Proxy is a lightweight application which provides bi-directional communication
|
// Proxy is a lightweight application which provides bi-directional communication
|
||||||
// between the browser extension and a running desktop application.
|
// between the browser extension and a running desktop application.
|
||||||
|
@ -10,10 +10,10 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.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 { Utils } from 'jslib/misc/utils';
|
|
||||||
import { SymmetricCryptoKey } from 'jslib/models/domain/symmetricCryptoKey';
|
|
||||||
import { StorageService } from 'jslib/abstractions';
|
import { StorageService } from 'jslib/abstractions';
|
||||||
import { ElectronConstants } from 'jslib/electron/electronConstants';
|
import { ElectronConstants } from 'jslib/electron/electronConstants';
|
||||||
|
import { Utils } from 'jslib/misc/utils';
|
||||||
|
import { SymmetricCryptoKey } from 'jslib/models/domain/symmetricCryptoKey';
|
||||||
|
|
||||||
const MessageValidTimeout = 10 * 1000;
|
const MessageValidTimeout = 10 * 1000;
|
||||||
const EncryptionAlgorithm = 'sha1';
|
const EncryptionAlgorithm = 'sha1';
|
||||||
|
11
tslint.json
11
tslint.json
@ -49,6 +49,15 @@
|
|||||||
"check-separator",
|
"check-separator",
|
||||||
"check-type"
|
"check-type"
|
||||||
],
|
],
|
||||||
"max-classes-per-file": false
|
"max-classes-per-file": false,
|
||||||
|
"ordered-imports": true,
|
||||||
|
"arrow-parens": [
|
||||||
|
true,
|
||||||
|
"ban-single-arg-parens"
|
||||||
|
],
|
||||||
|
"semicolon": [
|
||||||
|
true,
|
||||||
|
"always"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user