diff --git a/jslib b/jslib index c77441b353..e1ce721364 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit c77441b35348c821af7fd6261b6dc72732d5ebad +Subproject commit e1ce72136490b9055d8d6a03988e9d39ac560a89 diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 3cb4b512c4..2e7fa19fac 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -178,7 +178,8 @@ export default class MainBackground { this.cryptoFunctionService, this.platformUtilsService, this.logService); this.tokenService = new TokenService(this.storageService); this.appIdService = new AppIdService(this.storageService); - this.apiService = new ApiService(this.tokenService, this.platformUtilsService, + this.environmentService = new EnvironmentService(this.storageService); + this.apiService = new ApiService(this.tokenService, this.platformUtilsService, this.environmentService, (expired: boolean) => this.logout(expired)); this.userService = new UserService(this.tokenService, this.storageService); this.settingsService = new SettingsService(this.userService, this.storageService); @@ -224,9 +225,7 @@ export default class MainBackground { this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService, this.cryptoService); this.notificationsService = new NotificationsService(this.userService, this.syncService, this.appIdService, - this.apiService, this.vaultTimeoutService, () => this.logout(true), this.logService); - this.environmentService = new EnvironmentService(this.apiService, this.storageService, - this.notificationsService); + this.apiService, this.vaultTimeoutService, this.environmentService, () => this.logout(true), this.logService); this.popupUtilsService = new PopupUtilsService(this.platformUtilsService); this.systemService = new SystemService(this.storageService, this.vaultTimeoutService, this.messagingService, this.platformUtilsService, () => { @@ -295,7 +294,7 @@ export default class MainBackground { await this.setIcon(); this.cleanupNotificationQueue(); this.fullSync(true); - setTimeout(() => this.notificationsService.init(this.environmentService), 2500); + setTimeout(() => this.notificationsService.init(), 2500); resolve(); }, 500); }); diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index dcf77afd97..e51e5c8161 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -161,10 +161,7 @@ export default class RuntimeBackground { } break; case 'authResult': - let vaultUrl = this.environmentService.getWebVaultUrl(); - if (vaultUrl == null) { - vaultUrl = 'https://vault.bitwarden.com'; - } + const vaultUrl = this.environmentService.getWebVaultUrl(); if (msg.referrer == null || Utils.getHostname(vaultUrl) !== msg.referrer) { return; @@ -177,10 +174,7 @@ export default class RuntimeBackground { catch { } break; case 'webAuthnResult': - let vaultUrl2 = this.environmentService.getWebVaultUrl(); - if (vaultUrl2 == null) { - vaultUrl2 = 'https://vault.bitwarden.com'; - } + const vaultUrl2 = this.environmentService.getWebVaultUrl(); if (msg.referrer == null || Utils.getHostname(vaultUrl2) !== msg.referrer) { return; diff --git a/src/popup/accounts/register.component.ts b/src/popup/accounts/register.component.ts index f3273ad20a..75fbdca157 100644 --- a/src/popup/accounts/register.component.ts +++ b/src/popup/accounts/register.component.ts @@ -19,9 +19,8 @@ import { RegisterComponent as BaseRegisterComponent } from 'jslib-angular/compon export class RegisterComponent extends BaseRegisterComponent { constructor(authService: AuthService, router: Router, i18nService: I18nService, cryptoService: CryptoService, - apiService: ApiService, stateService: StateService, - platformUtilsService: PlatformUtilsService, passwordGenerationService: PasswordGenerationService, - environmentService: EnvironmentService) { + apiService: ApiService, stateService: StateService, platformUtilsService: PlatformUtilsService, + passwordGenerationService: PasswordGenerationService, environmentService: EnvironmentService) { super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService, passwordGenerationService, environmentService); } diff --git a/src/popup/accounts/sso.component.ts b/src/popup/accounts/sso.component.ts index ddf547ed12..34b3a77c01 100644 --- a/src/popup/accounts/sso.component.ts +++ b/src/popup/accounts/sso.component.ts @@ -29,14 +29,11 @@ export class SsoComponent extends BaseSsoComponent { storageService: StorageService, stateService: StateService, platformUtilsService: PlatformUtilsService, apiService: ApiService, cryptoFunctionService: CryptoFunctionService, passwordGenerationService: PasswordGenerationService, - syncService: SyncService, private environmentService: EnvironmentService) { + syncService: SyncService, environmentService: EnvironmentService) { super(authService, router, i18nService, route, storageService, stateService, platformUtilsService, - apiService, cryptoFunctionService, passwordGenerationService); + apiService, cryptoFunctionService, environmentService, passwordGenerationService); - let url = this.environmentService.getWebVaultUrl(); - if (url == null) { - url = 'https://vault.bitwarden.com'; - } + const url = this.environmentService.getWebVaultUrl(); this.redirectUri = url + '/sso-connector.html'; this.clientId = 'browser'; diff --git a/src/popup/services/services.module.ts b/src/popup/services/services.module.ts index 801dc628ae..707c6a1ea8 100644 --- a/src/popup/services/services.module.ts +++ b/src/popup/services/services.module.ts @@ -31,7 +31,7 @@ import { ExportService } from 'jslib-common/abstractions/export.service'; import { FileUploadService } from 'jslib-common/abstractions/fileUpload.service'; import { FolderService } from 'jslib-common/abstractions/folder.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; -import { LogService } from 'jslib-common/abstractions/log.service'; +import { LogService as LogServiceAbstraction } from 'jslib-common/abstractions/log.service'; import { MessagingService } from 'jslib-common/abstractions/messaging.service'; import { NotificationsService } from 'jslib-common/abstractions/notifications.service'; import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service'; @@ -140,7 +140,7 @@ export function initFactory(platformUtilsService: PlatformUtilsService, i18nServ }, { provide: FolderService, useFactory: getBgService('folderService'), deps: [] }, { provide: CollectionService, useFactory: getBgService('collectionService'), deps: [] }, - { provide: LogService, useFactory: getBgService('logService'), deps: [] }, + { provide: LogServiceAbstraction, useFactory: getBgService('logService'), deps: [] }, { provide: EnvironmentService, useFactory: getBgService('environmentService'), deps: [] }, { provide: TotpService, useFactory: getBgService('totpService'), deps: [] }, { provide: TokenService, useFactory: getBgService('tokenService'), deps: [] }, diff --git a/src/popup/settings/settings.component.ts b/src/popup/settings/settings.component.ts index 87315280aa..b22610fae1 100644 --- a/src/popup/settings/settings.component.ts +++ b/src/popup/settings/settings.component.ts @@ -318,10 +318,7 @@ export class SettingsComponent implements OnInit { } async webVault() { - let url = this.environmentService.getWebVaultUrl(); - if (url == null) { - url = 'https://vault.bitwarden.com'; - } + const url = this.environmentService.getWebVaultUrl(); BrowserApi.createNewTab(url); }