mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
replace electron store with lowdb
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { remote } from 'electron';
|
||||
|
||||
import {
|
||||
APP_INITIALIZER,
|
||||
NgModule,
|
||||
@@ -9,7 +11,6 @@ import { ElectronLogService } from 'jslib/electron/services/electronLog.service'
|
||||
import { ElectronPlatformUtilsService } from 'jslib/electron/services/electronPlatformUtils.service';
|
||||
import { ElectronRendererMessagingService } from 'jslib/electron/services/electronRendererMessaging.service';
|
||||
import { ElectronRendererSecureStorageService } from 'jslib/electron/services/electronRendererSecureStorage.service';
|
||||
import { ElectronStorageService } from 'jslib/electron/services/electronStorage.service';
|
||||
import { isDev } from 'jslib/electron/utils';
|
||||
|
||||
import { I18nService } from '../services/i18n.service';
|
||||
@@ -33,6 +34,7 @@ import { EnvironmentService } from 'jslib/services/environment.service';
|
||||
import { ExportService } from 'jslib/services/export.service';
|
||||
import { FolderService } from 'jslib/services/folder.service';
|
||||
import { LockService } from 'jslib/services/lock.service';
|
||||
import { LowdbStorageService } from 'jslib/services/lowdbStorage.service';
|
||||
import { PasswordGenerationService } from 'jslib/services/passwordGeneration.service';
|
||||
import { SettingsService } from 'jslib/services/settings.service';
|
||||
import { StateService } from 'jslib/services/state.service';
|
||||
@@ -75,7 +77,7 @@ const stateService = new StateService();
|
||||
const platformUtilsService = new ElectronPlatformUtilsService(i18nService, true);
|
||||
const broadcasterService = new BroadcasterService();
|
||||
const messagingService = new ElectronRendererMessagingService(broadcasterService);
|
||||
const storageService: StorageServiceAbstraction = new ElectronStorageService();
|
||||
const storageService: StorageServiceAbstraction = new LowdbStorageService(null, remote.app.getPath('userData'));
|
||||
const secureStorageService: StorageServiceAbstraction = new ElectronRendererSecureStorageService();
|
||||
const cryptoFunctionService: CryptoFunctionServiceAbstraction = new WebCryptoFunctionService(window,
|
||||
platformUtilsService);
|
||||
|
||||
@@ -12,11 +12,11 @@ import { MessagingMain } from './main/messaging.main';
|
||||
import { PowerMonitorMain } from './main/powerMonitor.main';
|
||||
|
||||
import { ConstantsService } from 'jslib/services/constants.service';
|
||||
import { LowdbStorageService } from 'jslib/services/lowdbStorage.service';
|
||||
|
||||
import { KeytarStorageListener } from 'jslib/electron/keytarStorageListener';
|
||||
import { ElectronLogService } from 'jslib/electron/services/electronLog.service';
|
||||
import { ElectronMainMessagingService } from 'jslib/electron/services/electronMainMessaging.service';
|
||||
import { ElectronStorageService } from 'jslib/electron/services/electronStorage.service';
|
||||
import { TrayMain } from 'jslib/electron/tray.main';
|
||||
import { UpdaterMain } from 'jslib/electron/updater.main';
|
||||
import { WindowMain } from 'jslib/electron/window.main';
|
||||
@@ -24,7 +24,7 @@ import { WindowMain } from 'jslib/electron/window.main';
|
||||
export class Main {
|
||||
logService: ElectronLogService;
|
||||
i18nService: I18nService;
|
||||
storageService: ElectronStorageService;
|
||||
storageService: LowdbStorageService;
|
||||
messagingService: ElectronMainMessagingService;
|
||||
keytarStorageListener: KeytarStorageListener;
|
||||
|
||||
@@ -65,7 +65,7 @@ export class Main {
|
||||
const storageDefaults: any = {};
|
||||
// Default lock options to "on restart".
|
||||
storageDefaults[ConstantsService.lockOptionKey] = -1;
|
||||
this.storageService = new ElectronStorageService(storageDefaults);
|
||||
this.storageService = new LowdbStorageService(storageDefaults, app.getPath('userData'));
|
||||
|
||||
this.windowMain = new WindowMain(this.storageService);
|
||||
this.messagingMain = new MessagingMain(this);
|
||||
@@ -88,6 +88,7 @@ export class Main {
|
||||
}
|
||||
|
||||
bootstrap() {
|
||||
this.storageService.init();
|
||||
this.keytarStorageListener.init();
|
||||
this.windowMain.init().then(async () => {
|
||||
const locale = await this.storageService.get<string>(ConstantsService.localeKey);
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"dependencies": {
|
||||
"desktop-idle": "1.1.1",
|
||||
"electron-log": "2.2.14",
|
||||
"electron-store": "1.3.0",
|
||||
"electron-updater": "2.21.4",
|
||||
"keytar": "4.1.0"
|
||||
"keytar": "4.1.0",
|
||||
"lowdb": "1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user