mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-14 20:01:31 +01:00
Use the helper methods in EnvironmentService (#1092)
This commit is contained in:
parent
35d6a28c94
commit
2b5f61cadd
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit 8bf0f75d9e9869bbb8df397fb0c3bae4359eacf0
|
Subproject commit e1ce72136490b9055d8d6a03988e9d39ac560a89
|
@ -7,6 +7,7 @@ import {
|
|||||||
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 { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.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 { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
@ -36,9 +37,10 @@ export class RegisterComponent extends BaseRegisterComponent {
|
|||||||
i18nService: I18nService, cryptoService: CryptoService,
|
i18nService: I18nService, cryptoService: CryptoService,
|
||||||
apiService: ApiService, private route: ActivatedRoute,
|
apiService: ApiService, private route: ActivatedRoute,
|
||||||
stateService: StateService, platformUtilsService: PlatformUtilsService,
|
stateService: StateService, platformUtilsService: PlatformUtilsService,
|
||||||
passwordGenerationService: PasswordGenerationService, private policyService: PolicyService) {
|
passwordGenerationService: PasswordGenerationService, private policyService: PolicyService,
|
||||||
|
environmentService: EnvironmentService) {
|
||||||
super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService,
|
super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService,
|
||||||
passwordGenerationService);
|
passwordGenerationService, environmentService);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPasswordScoreAlertDisplay() {
|
getPasswordScoreAlertDisplay() {
|
||||||
|
@ -7,6 +7,7 @@ import {
|
|||||||
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 { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service';
|
import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.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 { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
@ -26,10 +27,10 @@ export class SsoComponent extends BaseSsoComponent {
|
|||||||
i18nService: I18nService, route: ActivatedRoute,
|
i18nService: I18nService, route: ActivatedRoute,
|
||||||
storageService: StorageService, stateService: StateService,
|
storageService: StorageService, stateService: StateService,
|
||||||
platformUtilsService: PlatformUtilsService, apiService: ApiService,
|
platformUtilsService: PlatformUtilsService, apiService: ApiService,
|
||||||
cryptoFunctionService: CryptoFunctionService,
|
cryptoFunctionService: CryptoFunctionService, environmentService: EnvironmentService,
|
||||||
passwordGenerationService: PasswordGenerationService) {
|
passwordGenerationService: PasswordGenerationService) {
|
||||||
super(authService, router, i18nService, route, storageService, stateService, platformUtilsService,
|
super(authService, router, i18nService, route, storageService, stateService, platformUtilsService,
|
||||||
apiService, cryptoFunctionService, passwordGenerationService);
|
apiService, cryptoFunctionService, environmentService, passwordGenerationService);
|
||||||
this.redirectUri = window.location.origin + '/sso-connector.html';
|
this.redirectUri = window.location.origin + '/sso-connector.html';
|
||||||
this.clientId = 'web';
|
this.clientId = 'web';
|
||||||
}
|
}
|
||||||
|
@ -34,12 +34,7 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
|
|||||||
private environmentService: EnvironmentService) { }
|
private environmentService: EnvironmentService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.businessUrl = 'https://portal.bitwarden.com';
|
this.businessUrl = this.environmentService.getEnterpriseUrl();
|
||||||
if (this.environmentService.enterpriseUrl != null) {
|
|
||||||
this.businessUrl = this.environmentService.enterpriseUrl;
|
|
||||||
} else if (this.environmentService.baseUrl != null) {
|
|
||||||
this.businessUrl = this.environmentService.baseUrl + '/portal';
|
|
||||||
}
|
|
||||||
|
|
||||||
document.body.classList.remove('layout_frontend');
|
document.body.classList.remove('layout_frontend');
|
||||||
this.route.params.subscribe(async params => {
|
this.route.params.subscribe(async params => {
|
||||||
|
@ -149,12 +149,7 @@ export class PoliciesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Remove when removing deprecation warning
|
// Remove when removing deprecation warning
|
||||||
this.enterpriseUrl = 'https://portal.bitwarden.com';
|
this.enterpriseUrl = this.environmentService.getEnterpriseUrl();
|
||||||
if (this.environmentService.enterpriseUrl != null) {
|
|
||||||
this.enterpriseUrl = this.environmentService.enterpriseUrl;
|
|
||||||
} else if (this.environmentService.baseUrl != null) {
|
|
||||||
this.enterpriseUrl = this.environmentService.baseUrl + '/portal';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
|
@ -103,7 +103,8 @@ const cryptoService = new CryptoService(storageService,
|
|||||||
consoleLogService);
|
consoleLogService);
|
||||||
const tokenService = new TokenService(storageService);
|
const tokenService = new TokenService(storageService);
|
||||||
const appIdService = new AppIdService(storageService);
|
const appIdService = new AppIdService(storageService);
|
||||||
const apiService = new ApiService(tokenService, platformUtilsService,
|
const environmentService = new EnvironmentService(storageService);
|
||||||
|
const apiService = new ApiService(tokenService, platformUtilsService, environmentService,
|
||||||
async (expired: boolean) => messagingService.send('logout', { expired: expired }));
|
async (expired: boolean) => messagingService.send('logout', { expired: expired }));
|
||||||
const userService = new UserService(tokenService, storageService);
|
const userService = new UserService(tokenService, storageService);
|
||||||
const settingsService = new SettingsService(userService, storageService);
|
const settingsService = new SettingsService(userService, storageService);
|
||||||
@ -133,9 +134,8 @@ const authService = new AuthService(cryptoService, apiService,
|
|||||||
const exportService = new ExportService(folderService, cipherService, apiService, cryptoService);
|
const exportService = new ExportService(folderService, cipherService, apiService, cryptoService);
|
||||||
const importService = new ImportService(cipherService, folderService, apiService, i18nService, collectionService,
|
const importService = new ImportService(cipherService, folderService, apiService, i18nService, collectionService,
|
||||||
platformUtilsService, cryptoService);
|
platformUtilsService, cryptoService);
|
||||||
const notificationsService = new NotificationsService(userService, syncService, appIdService,
|
const notificationsService = new NotificationsService(userService, syncService, appIdService, apiService, vaultTimeoutService,
|
||||||
apiService, vaultTimeoutService, async () => messagingService.send('logout', { expired: true }), consoleLogService);
|
environmentService, async () => messagingService.send('logout', { expired: true }), consoleLogService);
|
||||||
const environmentService = new EnvironmentService(apiService, storageService, notificationsService);
|
|
||||||
const auditService = new AuditService(cryptoFunctionService, apiService);
|
const auditService = new AuditService(cryptoFunctionService, apiService);
|
||||||
const eventLoggingService = new EventLoggingService(storageService, apiService, userService, cipherService);
|
const eventLoggingService = new EventLoggingService(storageService, apiService, userService, cipherService);
|
||||||
const passwordRepromptService = new PasswordRepromptService(i18nService, cryptoService, platformUtilsService);
|
const passwordRepromptService = new PasswordRepromptService(i18nService, cryptoService, platformUtilsService);
|
||||||
@ -147,19 +147,16 @@ export function initFactory(): Function {
|
|||||||
await (storageService as HtmlStorageService).init();
|
await (storageService as HtmlStorageService).init();
|
||||||
|
|
||||||
if (process.env.ENV !== 'production' || platformUtilsService.isSelfHost()) {
|
if (process.env.ENV !== 'production' || platformUtilsService.isSelfHost()) {
|
||||||
environmentService.baseUrl = window.location.origin;
|
environmentService.setUrls({ base: window.location.origin }, false);
|
||||||
} else {
|
} else {
|
||||||
environmentService.notificationsUrl = 'https://notifications.bitwarden.com';
|
environmentService.setUrls({
|
||||||
environmentService.enterpriseUrl = 'https://portal.bitwarden.com';
|
base: window.location.origin,
|
||||||
|
notifications: 'https://notifications.bitwarden.com',
|
||||||
|
enterprise: 'https://portal.bitwarden.com',
|
||||||
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
apiService.setUrls({
|
setTimeout(() => notificationsService.init(), 3000);
|
||||||
base: window.location.origin,
|
|
||||||
api: null,
|
|
||||||
identity: null,
|
|
||||||
events: null,
|
|
||||||
});
|
|
||||||
setTimeout(() => notificationsService.init(environmentService), 3000);
|
|
||||||
|
|
||||||
vaultTimeoutService.init(true);
|
vaultTimeoutService.init(true);
|
||||||
const locale = await storageService.get<string>(ConstantsService.localeKey);
|
const locale = await storageService.get<string>(ConstantsService.localeKey);
|
||||||
|
@ -8,6 +8,7 @@ import { ActivatedRoute, 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 { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service';
|
import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.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 { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
@ -30,12 +31,12 @@ export class LinkSsoComponent extends SsoComponent implements AfterContentInit {
|
|||||||
apiService: ApiService, authService: AuthService,
|
apiService: ApiService, authService: AuthService,
|
||||||
router: Router, route: ActivatedRoute,
|
router: Router, route: ActivatedRoute,
|
||||||
cryptoFunctionService: CryptoFunctionService, passwordGenerationService: PasswordGenerationService,
|
cryptoFunctionService: CryptoFunctionService, passwordGenerationService: PasswordGenerationService,
|
||||||
storageService: StorageService, stateService: StateService) {
|
storageService: StorageService, stateService: StateService, environmentService: EnvironmentService) {
|
||||||
super(authService, router,
|
super(authService, router,
|
||||||
i18nService, route,
|
i18nService, route,
|
||||||
storageService, stateService,
|
storageService, stateService,
|
||||||
platformUtilsService, apiService,
|
platformUtilsService, apiService,
|
||||||
cryptoFunctionService, passwordGenerationService);
|
cryptoFunctionService, environmentService, passwordGenerationService);
|
||||||
|
|
||||||
this.returnUri = '/settings/organizations';
|
this.returnUri = '/settings/organizations';
|
||||||
this.redirectUri = window.location.origin + '/sso-connector.html';
|
this.redirectUri = window.location.origin + '/sso-connector.html';
|
||||||
|
Loading…
Reference in New Issue
Block a user