diff --git a/jslib b/jslib index 0fa88b44..49e06e77 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 0fa88b44b81730679fedf88a083b4b4b1f5c40ac +Subproject commit 49e06e77c4913867fc468f7d9e0b2b1529c1d181 diff --git a/package-lock.json b/package-lock.json index bbeb6dc0..b023b58f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -685,21 +685,6 @@ "webpack-sources": "1.2.0" } }, - "@types/lodash": { - "version": "4.14.116", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.116.tgz", - "integrity": "sha512-lRnAtKnxMXcYYXqOiotTmJd74uawNWuPnsnPrrO7HiFuE3npE2iQhfABatbYDyxTNqZNuXzcKGhw37R7RjBFLg==", - "dev": true - }, - "@types/lowdb": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/lowdb/-/lowdb-1.0.5.tgz", - "integrity": "sha512-UaaxeB1wUsDAXf9Iw5iulhR4hYnrbxEABVBze/Gkd8yhQzwA/Ay/FqyH2G8mo7T8tnZro6jP6ealoYrmirh1Yw==", - "dev": true, - "requires": { - "@types/lodash": "*" - } - }, "@types/lunr": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.1.6.tgz", @@ -2521,6 +2506,18 @@ } } }, + "conf": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/conf/-/conf-1.4.0.tgz", + "integrity": "sha512-bzlVWS2THbMetHqXKB8ypsXN4DQ/1qopGwNJi1eYbpwesJcd86FBjFciCQX/YwAhp9bM7NVnPFqZ5LpV7gP0Dg==", + "requires": { + "dot-prop": "^4.1.0", + "env-paths": "^1.0.0", + "make-dir": "^1.0.0", + "pkg-up": "^2.0.0", + "write-file-atomic": "^2.3.0" + } + }, "configstore": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", @@ -3182,7 +3179,6 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", - "dev": true, "requires": { "is-obj": "^1.0.0" } @@ -4115,6 +4111,14 @@ } } }, + "electron-store": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/electron-store/-/electron-store-1.3.0.tgz", + "integrity": "sha512-r1Pdl5MwpiCxgbsl0qnwv/GABO5+J/JTO16+KyqL+bOITIk9o3cq3Sw69uO9NgPkpfcKeEwxtJFbtbiBlGTiDA==", + "requires": { + "conf": "^1.3.0" + } + }, "electron-updater": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-4.0.6.tgz", @@ -4212,8 +4216,7 @@ "env-paths": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-1.0.0.tgz", - "integrity": "sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA=", - "dev": true + "integrity": "sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA=" }, "errno": { "version": "0.1.7", @@ -4623,7 +4626,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, "requires": { "locate-path": "^2.0.0" } @@ -6231,9 +6233,9 @@ } }, "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" }, "gulp": { "version": "4.0.0", @@ -6827,8 +6829,7 @@ "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" }, "in-publish": { "version": "2.0.0", @@ -7068,8 +7069,7 @@ "is-obj": { "version": "1.0.1", "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", - "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", - "dev": true + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" }, "is-path-cwd": { "version": "1.0.0", @@ -7124,11 +7124,6 @@ "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", "dev": true }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" - }, "is-redirect": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", @@ -7474,7 +7469,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, "requires": { "p-locate": "^2.0.0", "path-exists": "^3.0.0" @@ -7483,7 +7477,8 @@ "lodash": { "version": "4.17.10", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true }, "lodash._baseassign": { "version": "3.2.0", @@ -7642,18 +7637,6 @@ "signal-exit": "^3.0.0" } }, - "lowdb": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lowdb/-/lowdb-1.0.0.tgz", - "integrity": "sha512-2+x8esE/Wb9SQ1F9IHaYWfsC9FIecLOPrK4g17FGEayjUWH172H6nwicRovGvSE2CPZouc2MCIqCI7h9d+GftQ==", - "requires": { - "graceful-fs": "^4.1.3", - "is-promise": "^2.1.0", - "lodash": "4", - "pify": "^3.0.0", - "steno": "^0.4.1" - } - }, "lower-case": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", @@ -7694,7 +7677,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", - "dev": true, "requires": { "pify": "^3.0.0" } @@ -8916,7 +8898,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, "requires": { "p-try": "^1.0.0" } @@ -8925,7 +8906,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, "requires": { "p-limit": "^1.1.0" } @@ -8939,8 +8919,7 @@ "p-try": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" }, "package-json": { "version": "4.0.1", @@ -9075,8 +9054,7 @@ "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" }, "path-is-absolute": { "version": "1.0.1", @@ -9180,6 +9158,14 @@ "find-up": "^2.1.0" } }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "requires": { + "find-up": "^2.1.0" + } + }, "plist": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.1.tgz", @@ -10738,14 +10724,6 @@ "readable-stream": "^2.0.1" } }, - "steno": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/steno/-/steno-0.4.4.tgz", - "integrity": "sha1-BxEFvfwobmYVwEA8J+nXtdy4Vcs=", - "requires": { - "graceful-fs": "^4.1.3" - } - }, "stream-browserify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", @@ -13339,7 +13317,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", - "dev": true, "requires": { "graceful-fs": "^4.1.11", "imurmurhash": "^0.1.4", diff --git a/package.json b/package.json index 8f4037f2..c31f46e9 100644 --- a/package.json +++ b/package.json @@ -191,7 +191,6 @@ "devDependencies": { "@angular/compiler-cli": "^7.2.1", "@ngtools/webpack": "^7.2.2", - "@types/lowdb": "^1.0.1", "@types/lunr": "^2.1.6", "@types/node-forge": "^0.7.5", "@types/papaparse": "^4.5.3", @@ -250,9 +249,9 @@ "desktop-idle": "1.1.2", "duo_web_sdk": "git+https://github.com/duosecurity/duo_web_sdk.git", "electron-log": "2.2.17", + "electron-store": "1.3.0", "electron-updater": "4.0.6", "keytar": "4.2.1", - "lowdb": "1.0.0", "lunr": "2.3.3", "node-forge": "0.7.6", "nord": "0.2.1", diff --git a/src/app/services.module.ts b/src/app/services.module.ts index a4502131..84f235de 100644 --- a/src/app/services.module.ts +++ b/src/app/services.module.ts @@ -12,6 +12,7 @@ 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'; @@ -35,7 +36,6 @@ 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 { NotificationsService } from 'jslib/services/notifications.service'; import { PasswordGenerationService } from 'jslib/services/passwordGeneration.service'; import { SearchService } from 'jslib/services/search.service'; @@ -84,7 +84,7 @@ const stateService = new StateService(); const broadcasterService = new BroadcasterService(); const messagingService = new ElectronRendererMessagingService(broadcasterService); const platformUtilsService = new ElectronPlatformUtilsService(i18nService, messagingService, true); -const storageService: StorageServiceAbstraction = new LowdbStorageService(null, remote.app.getPath('userData')); +const storageService: StorageServiceAbstraction = new ElectronStorageService(remote.app.getPath('userData')); const secureStorageService: StorageServiceAbstraction = new ElectronRendererSecureStorageService(); const cryptoFunctionService: CryptoFunctionServiceAbstraction = new WebCryptoFunctionService(window, platformUtilsService); diff --git a/src/main.ts b/src/main.ts index 1dfd8142..9124e035 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,12 +8,12 @@ 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 { ElectronConstants } from 'jslib/electron/electronConstants'; 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'; @@ -21,7 +21,7 @@ import { WindowMain } from 'jslib/electron/window.main'; export class Main { logService: ElectronLogService; i18nService: I18nService; - storageService: LowdbStorageService; + storageService: ElectronStorageService; messagingService: ElectronMainMessagingService; keytarStorageListener: KeytarStorageListener; @@ -62,7 +62,7 @@ export class Main { const storageDefaults: any = {}; // Default lock options to "on restart". storageDefaults[ConstantsService.lockOptionKey] = -1; - this.storageService = new LowdbStorageService(storageDefaults, app.getPath('userData')); + this.storageService = new ElectronStorageService(app.getPath('userData'), storageDefaults); this.windowMain = new WindowMain(this.storageService); this.messagingMain = new MessagingMain(this); @@ -85,7 +85,6 @@ export class Main { } bootstrap() { - this.storageService.init(); this.keytarStorageListener.init(); this.windowMain.init().then(async () => { const locale = await this.storageService.get(ConstantsService.localeKey); diff --git a/src/package.json b/src/package.json index 2b0cda6a..487f2c6d 100644 --- a/src/package.json +++ b/src/package.json @@ -14,8 +14,8 @@ "dependencies": { "desktop-idle": "1.1.2", "electron-log": "2.2.17", + "electron-store": "1.3.0", "electron-updater": "4.0.6", - "keytar": "4.2.1", - "lowdb": "1.0.0" + "keytar": "4.2.1" } }