BEEEP: Refactor services DI (#1175)
This commit is contained in:
parent
00d57d0310
commit
04cfdb246d
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit 78429aa7201989ad74a9ca36cc6832fcce0d4aee
|
Subproject commit 5db94cc9d06ba478a29e9b625993108dfa0d7ec8
|
|
@ -10,6 +10,7 @@ import {
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||||
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
|
@ -22,8 +23,6 @@ import { StorageService } from 'jslib-common/abstractions/storage.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { UserService } from 'jslib-common/abstractions/user.service';
|
||||||
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
|
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
|
|
||||||
import { LockComponent as BaseLockComponent } from 'jslib-angular/components/lock.component';
|
import { LockComponent as BaseLockComponent } from 'jslib-angular/components/lock.component';
|
||||||
|
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
import { ConstantsService } from 'jslib-common/services/constants.service';
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { Router } from '@angular/router';
|
||||||
import { EnvironmentComponent } from './environment.component';
|
import { EnvironmentComponent } from './environment.component';
|
||||||
|
|
||||||
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service';
|
import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service';
|
||||||
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
|
@ -22,7 +23,6 @@ import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
import { LoginComponent as BaseLoginComponent } from 'jslib-angular/components/login.component';
|
import { LoginComponent as BaseLoginComponent } from 'jslib-angular/components/login.component';
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||||
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
|
@ -16,8 +17,6 @@ import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGen
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
|
|
||||||
import { RegisterComponent as BaseRegisterComponent } from 'jslib-angular/components/register.component';
|
import { RegisterComponent as BaseRegisterComponent } from 'jslib-angular/components/register.component';
|
||||||
|
|
||||||
const BroadcasterSubscriptionId = 'RegisterComponent';
|
const BroadcasterSubscriptionId = 'RegisterComponent';
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
@ -19,8 +20,6 @@ import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { UserService } from 'jslib-common/abstractions/user.service';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
|
|
||||||
const BroadcasterSubscriptionId = 'SetPasswordComponent';
|
const BroadcasterSubscriptionId = 'SetPasswordComponent';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -21,9 +21,8 @@ import { PremiumComponent } from './accounts/premium.component';
|
||||||
import { SettingsComponent } from './accounts/settings.component';
|
import { SettingsComponent } from './accounts/settings.component';
|
||||||
import { PasswordGeneratorHistoryComponent } from './vault/password-generator-history.component';
|
import { PasswordGeneratorHistoryComponent } from './vault/password-generator-history.component';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
|
|
||||||
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { CollectionService } from 'jslib-common/abstractions/collection.service';
|
import { CollectionService } from 'jslib-common/abstractions/collection.service';
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
ViewChild,
|
ViewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
|
@ -17,7 +18,6 @@ import { UserService } from 'jslib-common/abstractions/user.service';
|
||||||
|
|
||||||
import { SendComponent as BaseSendComponent } from 'jslib-angular/components/send/send.component';
|
import { SendComponent as BaseSendComponent } from 'jslib-angular/components/send/send.component';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
import { invokeMenu, RendererMenuItem } from 'jslib-electron/utils';
|
import { invokeMenu, RendererMenuItem } from 'jslib-electron/utils';
|
||||||
|
|
||||||
import { SendView } from 'jslib-common/models/view/sendView';
|
import { SendView } from 'jslib-common/models/view/sendView';
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
import {
|
import {
|
||||||
APP_INITIALIZER,
|
APP_INITIALIZER,
|
||||||
LOCALE_ID,
|
|
||||||
NgModule,
|
NgModule,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { ToasterModule } from 'angular2-toaster';
|
|
||||||
|
|
||||||
import { ElectronLogService } from 'jslib-electron/services/electronLog.service';
|
import { ElectronLogService } from 'jslib-electron/services/electronLog.service';
|
||||||
import { ElectronPlatformUtilsService } from 'jslib-electron/services/electronPlatformUtils.service';
|
import { ElectronPlatformUtilsService } from 'jslib-electron/services/electronPlatformUtils.service';
|
||||||
import { ElectronRendererMessagingService } from 'jslib-electron/services/electronRendererMessaging.service';
|
import { ElectronRendererMessagingService } from 'jslib-electron/services/electronRendererMessaging.service';
|
||||||
|
@ -16,143 +13,44 @@ import { I18nService } from '../services/i18n.service';
|
||||||
import { NativeMessagingService } from '../services/nativeMessaging.service';
|
import { NativeMessagingService } from '../services/nativeMessaging.service';
|
||||||
import { PasswordRepromptService } from '../services/passwordReprompt.service';
|
import { PasswordRepromptService } from '../services/passwordReprompt.service';
|
||||||
|
|
||||||
import { AuthGuardService } from 'jslib-angular/services/auth-guard.service';
|
import { JslibServicesModule } from 'jslib-angular/services/jslib-services.module';
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
import { LockGuardService } from 'jslib-angular/services/lock-guard.service';
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
|
||||||
import { UnauthGuardService } from 'jslib-angular/services/unauth-guard.service';
|
|
||||||
import { ValidationService } from 'jslib-angular/services/validation.service';
|
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/services/api.service';
|
|
||||||
import { AppIdService } from 'jslib-common/services/appId.service';
|
|
||||||
import { AuditService } from 'jslib-common/services/audit.service';
|
|
||||||
import { AuthService } from 'jslib-common/services/auth.service';
|
import { AuthService } from 'jslib-common/services/auth.service';
|
||||||
import { CipherService } from 'jslib-common/services/cipher.service';
|
|
||||||
import { CollectionService } from 'jslib-common/services/collection.service';
|
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
import { ConstantsService } from 'jslib-common/services/constants.service';
|
||||||
import { ContainerService } from 'jslib-common/services/container.service';
|
import { ContainerService } from 'jslib-common/services/container.service';
|
||||||
import { EnvironmentService } from 'jslib-common/services/environment.service';
|
|
||||||
import { EventService } from 'jslib-common/services/event.service';
|
import { EventService } from 'jslib-common/services/event.service';
|
||||||
import { ExportService } from 'jslib-common/services/export.service';
|
|
||||||
import { FileUploadService } from 'jslib-common/services/fileUpload.service';
|
|
||||||
import { FolderService } from 'jslib-common/services/folder.service';
|
|
||||||
import { KeyConnectorService } from 'jslib-common/services/keyConnector.service';
|
|
||||||
import { NotificationsService } from 'jslib-common/services/notifications.service';
|
|
||||||
import { PasswordGenerationService } from 'jslib-common/services/passwordGeneration.service';
|
|
||||||
import { PolicyService } from 'jslib-common/services/policy.service';
|
|
||||||
import { SearchService } from 'jslib-common/services/search.service';
|
|
||||||
import { SendService } from 'jslib-common/services/send.service';
|
|
||||||
import { SettingsService } from 'jslib-common/services/settings.service';
|
|
||||||
import { StateService } from 'jslib-common/services/state.service';
|
|
||||||
import { SyncService } from 'jslib-common/services/sync.service';
|
|
||||||
import { SystemService } from 'jslib-common/services/system.service';
|
import { SystemService } from 'jslib-common/services/system.service';
|
||||||
import { TokenService } from 'jslib-common/services/token.service';
|
|
||||||
import { TotpService } from 'jslib-common/services/totp.service';
|
|
||||||
import { UserService } from 'jslib-common/services/user.service';
|
|
||||||
import { UserVerificationService } from 'jslib-common/services/userVerification.service';
|
|
||||||
import { VaultTimeoutService } from 'jslib-common/services/vaultTimeout.service';
|
import { VaultTimeoutService } from 'jslib-common/services/vaultTimeout.service';
|
||||||
import { WebCryptoFunctionService } from 'jslib-common/services/webCryptoFunction.service';
|
|
||||||
|
|
||||||
import { ElectronCryptoService } from 'jslib-electron/services/electronCrypto.service';
|
import { ElectronCryptoService } from 'jslib-electron/services/electronCrypto.service';
|
||||||
|
|
||||||
import { ApiService as ApiServiceAbstraction } from 'jslib-common/abstractions/api.service';
|
|
||||||
import { AuditService as AuditServiceAbstraction } from 'jslib-common/abstractions/audit.service';
|
|
||||||
import { AuthService as AuthServiceAbstraction } from 'jslib-common/abstractions/auth.service';
|
import { AuthService as AuthServiceAbstraction } from 'jslib-common/abstractions/auth.service';
|
||||||
import { CipherService as CipherServiceAbstraction } from 'jslib-common/abstractions/cipher.service';
|
import { BroadcasterService as BroadcasterServiceAbstraction } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { CollectionService as CollectionServiceAbstraction } from 'jslib-common/abstractions/collection.service';
|
|
||||||
import { CryptoService as CryptoServiceAbstraction } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService as CryptoServiceAbstraction } from 'jslib-common/abstractions/crypto.service';
|
||||||
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from 'jslib-common/abstractions/cryptoFunction.service';
|
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from 'jslib-common/abstractions/cryptoFunction.service';
|
||||||
import { EnvironmentService as EnvironmentServiceAbstraction } from 'jslib-common/abstractions/environment.service';
|
import { EnvironmentService as EnvironmentServiceAbstraction } from 'jslib-common/abstractions/environment.service';
|
||||||
import { EventService as EventServiceAbstraction } from 'jslib-common/abstractions/event.service';
|
import { EventService as EventServiceAbstraction } from 'jslib-common/abstractions/event.service';
|
||||||
import { ExportService as ExportServiceAbstraction } from 'jslib-common/abstractions/export.service';
|
|
||||||
import { FileUploadService as FileUploadServiceAbstraction } from 'jslib-common/abstractions/fileUpload.service';
|
|
||||||
import { FolderService as FolderServiceAbstraction } from 'jslib-common/abstractions/folder.service';
|
|
||||||
import { I18nService as I18nServiceAbstraction } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService as I18nServiceAbstraction } from 'jslib-common/abstractions/i18n.service';
|
||||||
import { KeyConnectorService as KeyConnectorServiceAbstraction } from 'jslib-common/abstractions/keyConnector.service';
|
|
||||||
import { LogService as LogServiceAbstraction } from 'jslib-common/abstractions/log.service';
|
import { LogService as LogServiceAbstraction } from 'jslib-common/abstractions/log.service';
|
||||||
import { MessagingService as MessagingServiceAbstraction } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService as MessagingServiceAbstraction } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { NotificationsService as NotificationsServiceAbstraction } from 'jslib-common/abstractions/notifications.service';
|
import { NotificationsService as NotificationsServiceAbstraction } from 'jslib-common/abstractions/notifications.service';
|
||||||
import {
|
|
||||||
PasswordGenerationService as PasswordGenerationServiceAbstraction,
|
|
||||||
} from 'jslib-common/abstractions/passwordGeneration.service';
|
|
||||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { PolicyService as PolicyServiceAbstraction } from 'jslib-common/abstractions/policy.service';
|
|
||||||
import { SearchService as SearchServiceAbstraction } from 'jslib-common/abstractions/search.service';
|
|
||||||
import { SendService as SendServiceAbstraction } from 'jslib-common/abstractions/send.service';
|
|
||||||
import { SettingsService as SettingsServiceAbstraction } from 'jslib-common/abstractions/settings.service';
|
|
||||||
import { StateService as StateServiceAbstraction } from 'jslib-common/abstractions/state.service';
|
import { StateService as StateServiceAbstraction } from 'jslib-common/abstractions/state.service';
|
||||||
import { StorageService as StorageServiceAbstraction } from 'jslib-common/abstractions/storage.service';
|
import { StorageService as StorageServiceAbstraction } from 'jslib-common/abstractions/storage.service';
|
||||||
import { SyncService as SyncServiceAbstraction } from 'jslib-common/abstractions/sync.service';
|
import { SyncService as SyncServiceAbstraction } from 'jslib-common/abstractions/sync.service';
|
||||||
import { SystemService as SystemServiceAbstraction } from 'jslib-common/abstractions/system.service';
|
import { SystemService as SystemServiceAbstraction } from 'jslib-common/abstractions/system.service';
|
||||||
import { TokenService as TokenServiceAbstraction } from 'jslib-common/abstractions/token.service';
|
|
||||||
import { TotpService as TotpServiceAbstraction } from 'jslib-common/abstractions/totp.service';
|
|
||||||
import { UserService as UserServiceAbstraction } from 'jslib-common/abstractions/user.service';
|
|
||||||
import { UserVerificationService as UserVerificationServiceAbstraction } from 'jslib-common/abstractions/userVerification.service';
|
|
||||||
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from 'jslib-common/abstractions/vaultTimeout.service';
|
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from 'jslib-common/abstractions/vaultTimeout.service';
|
||||||
|
|
||||||
import { ThemeType } from 'jslib-common/enums/themeType';
|
import { ThemeType } from 'jslib-common/enums/themeType';
|
||||||
|
|
||||||
const logService = new ElectronLogService();
|
export function initFactory(window: Window, environmentService: EnvironmentServiceAbstraction,
|
||||||
const i18nService = new I18nService(window.navigator.language, './locales');
|
syncService: SyncServiceAbstraction, vaultTimeoutService: VaultTimeoutService,
|
||||||
const stateService = new StateService();
|
storageService: StorageServiceAbstraction, i18nService: I18nService, eventService: EventService,
|
||||||
const broadcasterService = new BroadcasterService();
|
authService: AuthService, notificationsService: NotificationsServiceAbstraction,
|
||||||
const messagingService = new ElectronRendererMessagingService(broadcasterService);
|
platformUtilsService: PlatformUtilsServiceAbstraction, stateService: StateServiceAbstraction,
|
||||||
const storageService: StorageServiceAbstraction = new ElectronRendererStorageService();
|
cryptoService: CryptoServiceAbstraction): Function {
|
||||||
const platformUtilsService = new ElectronPlatformUtilsService(i18nService, messagingService, true, storageService);
|
|
||||||
const secureStorageService: StorageServiceAbstraction = new ElectronRendererSecureStorageService();
|
|
||||||
const cryptoFunctionService: CryptoFunctionServiceAbstraction = new WebCryptoFunctionService(window,
|
|
||||||
platformUtilsService);
|
|
||||||
const cryptoService = new ElectronCryptoService(storageService, secureStorageService, cryptoFunctionService,
|
|
||||||
platformUtilsService, logService);
|
|
||||||
const tokenService = new TokenService(storageService);
|
|
||||||
const appIdService = new AppIdService(storageService);
|
|
||||||
const environmentService = new EnvironmentService(storageService);
|
|
||||||
const apiService = new ApiService(tokenService, platformUtilsService, environmentService,
|
|
||||||
async (expired: boolean) => messagingService.send('logout', { expired: expired }));
|
|
||||||
const userService = new UserService(tokenService, storageService);
|
|
||||||
const settingsService = new SettingsService(userService, storageService);
|
|
||||||
export let searchService: SearchService = null;
|
|
||||||
const fileUploadService = new FileUploadService(logService, apiService);
|
|
||||||
const cipherService = new CipherService(cryptoService, userService, settingsService,
|
|
||||||
apiService, fileUploadService, storageService, i18nService, () => searchService,
|
|
||||||
logService);
|
|
||||||
const folderService = new FolderService(cryptoService, userService, apiService, storageService,
|
|
||||||
i18nService, cipherService);
|
|
||||||
const collectionService = new CollectionService(cryptoService, userService, storageService, i18nService);
|
|
||||||
searchService = new SearchService(cipherService, logService, i18nService);
|
|
||||||
const sendService = new SendService(cryptoService, userService, apiService, fileUploadService, storageService,
|
|
||||||
i18nService, cryptoFunctionService);
|
|
||||||
const policyService = new PolicyService(userService, storageService, apiService);
|
|
||||||
const keyConnectorService = new KeyConnectorService(storageService, userService, cryptoService, apiService,
|
|
||||||
tokenService, logService);
|
|
||||||
const vaultTimeoutService = new VaultTimeoutService(cipherService, folderService, collectionService,
|
|
||||||
cryptoService, platformUtilsService, storageService, messagingService, searchService, userService, tokenService,
|
|
||||||
policyService, keyConnectorService, null, async () => messagingService.send('logout', { expired: false }));
|
|
||||||
const syncService = new SyncService(userService, apiService, settingsService,
|
|
||||||
folderService, cipherService, cryptoService, collectionService, storageService, messagingService, policyService,
|
|
||||||
sendService, logService, tokenService, keyConnectorService,
|
|
||||||
async (expired: boolean) => messagingService.send('logout', { expired: expired }));
|
|
||||||
const passwordGenerationService = new PasswordGenerationService(cryptoService, storageService, policyService);
|
|
||||||
const totpService = new TotpService(storageService, cryptoFunctionService, logService);
|
|
||||||
const containerService = new ContainerService(cryptoService);
|
|
||||||
const authService = new AuthService(cryptoService, apiService, userService, tokenService, appIdService,
|
|
||||||
i18nService, platformUtilsService, messagingService, vaultTimeoutService, logService, cryptoFunctionService,
|
|
||||||
environmentService, keyConnectorService);
|
|
||||||
const exportService = new ExportService(folderService, cipherService, apiService, cryptoService);
|
|
||||||
const auditService = new AuditService(cryptoFunctionService, apiService);
|
|
||||||
const notificationsService = new NotificationsService(userService, syncService, appIdService,
|
|
||||||
apiService, vaultTimeoutService, environmentService, async () => messagingService.send('logout', { expired: true }), logService);
|
|
||||||
const eventService = new EventService(storageService, apiService, userService, cipherService, logService);
|
|
||||||
const systemService = new SystemService(storageService, vaultTimeoutService, messagingService, platformUtilsService,
|
|
||||||
null);
|
|
||||||
const nativeMessagingService = new NativeMessagingService(cryptoFunctionService, cryptoService, platformUtilsService,
|
|
||||||
logService, i18nService, userService, messagingService, vaultTimeoutService, storageService);
|
|
||||||
const userVerificationService = new UserVerificationService(cryptoService, i18nService, apiService);
|
|
||||||
|
|
||||||
containerService.attachToGlobal(window);
|
|
||||||
|
|
||||||
export function initFactory(): Function {
|
|
||||||
return async () => {
|
return async () => {
|
||||||
await environmentService.setUrlsFromStorage();
|
await environmentService.setUrlsFromStorage();
|
||||||
syncService.fullSync(true);
|
syncService.fullSync(true);
|
||||||
|
@ -191,67 +89,84 @@ export function initFactory(): Function {
|
||||||
if (installAction != null) {
|
if (installAction != null) {
|
||||||
await storageService.save(ConstantsService.installedVersionKey, currentVersion);
|
await storageService.save(ConstantsService.installedVersionKey, currentVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const containerService = new ContainerService(cryptoService);
|
||||||
|
containerService.attachToGlobal(window);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
ToasterModule,
|
JslibServicesModule,
|
||||||
],
|
],
|
||||||
declarations: [],
|
declarations: [],
|
||||||
providers: [
|
providers: [
|
||||||
ValidationService,
|
|
||||||
AuthGuardService,
|
|
||||||
UnauthGuardService,
|
|
||||||
LockGuardService,
|
|
||||||
ModalService,
|
|
||||||
{ provide: AuditServiceAbstraction, useValue: auditService },
|
|
||||||
{ provide: AuthServiceAbstraction, useValue: authService },
|
|
||||||
{ provide: CipherServiceAbstraction, useValue: cipherService },
|
|
||||||
{ provide: FolderServiceAbstraction, useValue: folderService },
|
|
||||||
{ provide: CollectionServiceAbstraction, useValue: collectionService },
|
|
||||||
{ provide: EnvironmentServiceAbstraction, useValue: environmentService },
|
|
||||||
{ provide: TotpServiceAbstraction, useValue: totpService },
|
|
||||||
{ provide: TokenServiceAbstraction, useValue: tokenService },
|
|
||||||
{ provide: I18nServiceAbstraction, useValue: i18nService },
|
|
||||||
{ provide: CryptoServiceAbstraction, useValue: cryptoService },
|
|
||||||
{ provide: CryptoFunctionServiceAbstraction, useValue: cryptoFunctionService },
|
|
||||||
{ provide: PlatformUtilsServiceAbstraction, useValue: platformUtilsService },
|
|
||||||
{ provide: PasswordGenerationServiceAbstraction, useValue: passwordGenerationService },
|
|
||||||
{ provide: ApiServiceAbstraction, useValue: apiService },
|
|
||||||
{ provide: SyncServiceAbstraction, useValue: syncService },
|
|
||||||
{ provide: UserServiceAbstraction, useValue: userService },
|
|
||||||
{ provide: MessagingServiceAbstraction, useValue: messagingService },
|
|
||||||
{ provide: BroadcasterService, useValue: broadcasterService },
|
|
||||||
{ provide: SettingsServiceAbstraction, useValue: settingsService },
|
|
||||||
{ provide: VaultTimeoutServiceAbstraction, useValue: vaultTimeoutService },
|
|
||||||
{ provide: StorageServiceAbstraction, useValue: storageService },
|
|
||||||
{ provide: StateServiceAbstraction, useValue: stateService },
|
|
||||||
{ provide: LogServiceAbstraction, useValue: logService },
|
|
||||||
{ provide: ExportServiceAbstraction, useValue: exportService },
|
|
||||||
{ provide: SearchServiceAbstraction, useValue: searchService },
|
|
||||||
{ provide: NotificationsServiceAbstraction, useValue: notificationsService },
|
|
||||||
{ provide: SystemServiceAbstraction, useValue: systemService },
|
|
||||||
{ provide: EventServiceAbstraction, useValue: eventService },
|
|
||||||
{ provide: PolicyServiceAbstraction, useValue: policyService },
|
|
||||||
{ provide: SendServiceAbstraction, useValue: sendService },
|
|
||||||
{ provide: CryptoFunctionServiceAbstraction, useValue: cryptoFunctionService },
|
|
||||||
{ provide: NativeMessagingService, useValue: nativeMessagingService },
|
|
||||||
{ provide: FileUploadServiceAbstraction, useValue: fileUploadService },
|
|
||||||
{ provide: KeyConnectorServiceAbstraction, useValue: keyConnectorService },
|
|
||||||
{ provide: UserVerificationServiceAbstraction, useValue: userVerificationService },
|
|
||||||
{ provide: PasswordRepromptServiceAbstraction, useClass: PasswordRepromptService },
|
|
||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: initFactory,
|
useFactory: initFactory,
|
||||||
deps: [],
|
deps: [
|
||||||
|
'WINDOW',
|
||||||
|
EnvironmentServiceAbstraction,
|
||||||
|
SyncServiceAbstraction,
|
||||||
|
VaultTimeoutServiceAbstraction,
|
||||||
|
StorageServiceAbstraction,
|
||||||
|
I18nServiceAbstraction,
|
||||||
|
EventServiceAbstraction,
|
||||||
|
AuthServiceAbstraction,
|
||||||
|
NotificationsServiceAbstraction,
|
||||||
|
PlatformUtilsServiceAbstraction,
|
||||||
|
StateServiceAbstraction,
|
||||||
|
CryptoServiceAbstraction,
|
||||||
|
],
|
||||||
multi: true,
|
multi: true,
|
||||||
},
|
},
|
||||||
|
{ provide: LogServiceAbstraction, useClass: ElectronLogService, deps: [] },
|
||||||
{
|
{
|
||||||
provide: LOCALE_ID,
|
provide: PlatformUtilsServiceAbstraction,
|
||||||
useFactory: () => i18nService.translationLocale,
|
useFactory: (i18nService: I18nServiceAbstraction, messagingService: MessagingServiceAbstraction,
|
||||||
deps: [],
|
storageService: StorageServiceAbstraction) => new ElectronPlatformUtilsService(i18nService,
|
||||||
|
messagingService, true, storageService),
|
||||||
|
deps: [
|
||||||
|
I18nServiceAbstraction,
|
||||||
|
MessagingServiceAbstraction,
|
||||||
|
StorageServiceAbstraction,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
provide: I18nServiceAbstraction,
|
||||||
|
useFactory: (window: Window) => new I18nService(window.navigator.language, './locales'),
|
||||||
|
deps: [ 'WINDOW' ],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: MessagingServiceAbstraction,
|
||||||
|
useClass: ElectronRendererMessagingService,
|
||||||
|
deps: [ BroadcasterServiceAbstraction ],
|
||||||
|
},
|
||||||
|
{ provide: StorageServiceAbstraction, useClass: ElectronRendererStorageService },
|
||||||
|
{ provide: 'SECURE_STORAGE', useClass: ElectronRendererSecureStorageService },
|
||||||
|
{
|
||||||
|
provide: CryptoServiceAbstraction,
|
||||||
|
useClass: ElectronCryptoService,
|
||||||
|
deps: [
|
||||||
|
StorageServiceAbstraction,
|
||||||
|
'SECURE_STORAGE',
|
||||||
|
CryptoFunctionServiceAbstraction,
|
||||||
|
PlatformUtilsServiceAbstraction,
|
||||||
|
LogServiceAbstraction,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: SystemServiceAbstraction,
|
||||||
|
useClass: SystemService,
|
||||||
|
deps: [
|
||||||
|
StorageServiceAbstraction,
|
||||||
|
VaultTimeoutServiceAbstraction,
|
||||||
|
MessagingServiceAbstraction,
|
||||||
|
PlatformUtilsServiceAbstraction,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ provide: PasswordRepromptServiceAbstraction, useClass: PasswordRepromptService },
|
||||||
|
NativeMessagingService,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ServicesModule {
|
export class ServicesModule {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
import { NgForm } from '@angular/forms';
|
import { NgForm } from '@angular/forms';
|
||||||
|
|
||||||
import { AuditService } from 'jslib-common/abstractions/audit.service';
|
import { AuditService } from 'jslib-common/abstractions/audit.service';
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { CollectionService } from 'jslib-common/abstractions/collection.service';
|
import { CollectionService } from 'jslib-common/abstractions/collection.service';
|
||||||
import { EventService } from 'jslib-common/abstractions/event.service';
|
import { EventService } from 'jslib-common/abstractions/event.service';
|
||||||
|
@ -21,8 +22,6 @@ import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||||
import { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { UserService } from 'jslib-common/abstractions/user.service';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
|
|
||||||
import { AddEditComponent as BaseAddEditComponent } from 'jslib-angular/components/add-edit.component';
|
import { AddEditComponent as BaseAddEditComponent } from 'jslib-angular/components/add-edit.component';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { FormBuilder } from '@angular/forms';
|
||||||
|
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
|
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||||
import { EventService } from 'jslib-common/abstractions/event.service';
|
import { EventService } from 'jslib-common/abstractions/event.service';
|
||||||
import { ExportService } from 'jslib-common/abstractions/export.service';
|
import { ExportService } from 'jslib-common/abstractions/export.service';
|
||||||
|
@ -15,8 +16,6 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se
|
||||||
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||||
import { UserVerificationService } from 'jslib-common/abstractions/userVerification.service';
|
import { UserVerificationService } from 'jslib-common/abstractions/userVerification.service';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
|
|
||||||
import { ExportComponent as BaseExportComponent } from 'jslib-angular/components/export.component';
|
import { ExportComponent as BaseExportComponent } from 'jslib-angular/components/export.component';
|
||||||
|
|
||||||
const BroadcasterSubscriptionId = 'ExportComponent';
|
const BroadcasterSubscriptionId = 'ExportComponent';
|
||||||
|
|
|
@ -16,8 +16,6 @@ import { first } from 'rxjs/operators';
|
||||||
|
|
||||||
import { ToasterService } from 'angular2-toaster';
|
import { ToasterService } from 'angular2-toaster';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
|
|
||||||
import { AddEditComponent } from './add-edit.component';
|
import { AddEditComponent } from './add-edit.component';
|
||||||
import { AttachmentsComponent } from './attachments.component';
|
import { AttachmentsComponent } from './attachments.component';
|
||||||
import { CiphersComponent } from './ciphers.component';
|
import { CiphersComponent } from './ciphers.component';
|
||||||
|
@ -39,6 +37,7 @@ import { FolderView } from 'jslib-common/models/view/folderView';
|
||||||
import { ModalRef } from 'jslib-angular/components/modal/modal.ref';
|
import { ModalRef } from 'jslib-angular/components/modal/modal.ref';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { EventService } from 'jslib-common/abstractions/event.service';
|
import { EventService } from 'jslib-common/abstractions/event.service';
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
@ -47,6 +46,7 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { UserService } from 'jslib-common/abstractions/user.service';
|
||||||
|
|
||||||
import { invokeMenu, RendererMenuItem } from 'jslib-electron/utils';
|
import { invokeMenu, RendererMenuItem } from 'jslib-electron/utils';
|
||||||
|
|
||||||
const BroadcasterSubscriptionId = 'VaultComponent';
|
const BroadcasterSubscriptionId = 'VaultComponent';
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { AuditService } from 'jslib-common/abstractions/audit.service';
|
import { AuditService } from 'jslib-common/abstractions/audit.service';
|
||||||
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||||
import { EventService } from 'jslib-common/abstractions/event.service';
|
import { EventService } from 'jslib-common/abstractions/event.service';
|
||||||
|
@ -21,8 +22,6 @@ import { TokenService } from 'jslib-common/abstractions/token.service';
|
||||||
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { UserService } from 'jslib-common/abstractions/user.service';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
|
||||||
|
|
||||||
import { ViewComponent as BaseViewComponent } from 'jslib-angular/components/view.component';
|
import { ViewComponent as BaseViewComponent } from 'jslib-angular/components/view.component';
|
||||||
|
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ import { ElectronConstants } from 'jslib-electron/electronConstants';
|
||||||
const MessageValidTimeout = 10 * 1000;
|
const MessageValidTimeout = 10 * 1000;
|
||||||
const EncryptionAlgorithm = 'sha1';
|
const EncryptionAlgorithm = 'sha1';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class NativeMessagingService {
|
export class NativeMessagingService {
|
||||||
private sharedSecrets = new Map<string, SymmetricCryptoKey>();
|
private sharedSecrets = new Map<string, SymmetricCryptoKey>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue