use EnvironmentService to get the appropriate web vault URL (#5862)
This commit is contained in:
parent
7ef2acc11a
commit
fb74c2d6ee
|
@ -5,6 +5,7 @@ import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
||||||
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
||||||
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
||||||
import { ThemeType } from "@bitwarden/common/enums";
|
import { ThemeType } from "@bitwarden/common/enums";
|
||||||
|
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
|
||||||
|
@ -30,7 +31,8 @@ export default class NotificationBackground {
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
private folderService: FolderService,
|
private folderService: FolderService,
|
||||||
private stateService: BrowserStateService
|
private stateService: BrowserStateService,
|
||||||
|
private environmentService: EnvironmentService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
|
@ -167,6 +169,7 @@ export default class NotificationBackground {
|
||||||
isVaultLocked: this.notificationQueue[i].wasVaultLocked,
|
isVaultLocked: this.notificationQueue[i].wasVaultLocked,
|
||||||
theme: await this.getCurrentTheme(),
|
theme: await this.getCurrentTheme(),
|
||||||
removeIndividualVault: await this.removeIndividualVault(),
|
removeIndividualVault: await this.removeIndividualVault(),
|
||||||
|
webVaultURL: await this.environmentService.getWebVaultUrl(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else if (this.notificationQueue[i].type === NotificationQueueMessageType.ChangePassword) {
|
} else if (this.notificationQueue[i].type === NotificationQueueMessageType.ChangePassword) {
|
||||||
|
@ -175,6 +178,7 @@ export default class NotificationBackground {
|
||||||
typeData: {
|
typeData: {
|
||||||
isVaultLocked: this.notificationQueue[i].wasVaultLocked,
|
isVaultLocked: this.notificationQueue[i].wasVaultLocked,
|
||||||
theme: await this.getCurrentTheme(),
|
theme: await this.getCurrentTheme(),
|
||||||
|
webVaultURL: await this.environmentService.getWebVaultUrl(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -834,6 +834,7 @@ document.addEventListener("DOMContentLoaded", (event) => {
|
||||||
isVaultLocked: typeData.isVaultLocked,
|
isVaultLocked: typeData.isVaultLocked,
|
||||||
theme: typeData.theme,
|
theme: typeData.theme,
|
||||||
removeIndividualVault: typeData.removeIndividualVault,
|
removeIndividualVault: typeData.removeIndividualVault,
|
||||||
|
webVaultURL: typeData.webVaultURL,
|
||||||
};
|
};
|
||||||
const barQueryString = new URLSearchParams(barQueryParams).toString();
|
const barQueryString = new URLSearchParams(barQueryParams).toString();
|
||||||
const barPage = "notification/bar.html?" + barQueryString;
|
const barPage = "notification/bar.html?" + barQueryString;
|
||||||
|
|
|
@ -30,7 +30,16 @@ function load() {
|
||||||
notificationChangeDesc: chrome.i18n.getMessage("notificationChangeDesc"),
|
notificationChangeDesc: chrome.i18n.getMessage("notificationChangeDesc"),
|
||||||
};
|
};
|
||||||
|
|
||||||
document.getElementById("logo-link").title = i18n.appName;
|
const logoLink = document.getElementById("logo-link") as HTMLAnchorElement;
|
||||||
|
logoLink.title = i18n.appName;
|
||||||
|
|
||||||
|
// Update logo link to user's regional domain
|
||||||
|
const webVaultURL = getQueryVariable("webVaultURL");
|
||||||
|
const newVaultURL = webVaultURL && decodeURIComponent(webVaultURL);
|
||||||
|
|
||||||
|
if (newVaultURL && newVaultURL !== logoLink.href) {
|
||||||
|
logoLink.href = newVaultURL;
|
||||||
|
}
|
||||||
|
|
||||||
// i18n for "Add" template
|
// i18n for "Add" template
|
||||||
const addTemplate = document.getElementById("template-add") as HTMLTemplateElement;
|
const addTemplate = document.getElementById("template-add") as HTMLTemplateElement;
|
||||||
|
|
|
@ -570,7 +570,8 @@ export default class MainBackground {
|
||||||
this.authService,
|
this.authService,
|
||||||
this.policyService,
|
this.policyService,
|
||||||
this.folderService,
|
this.folderService,
|
||||||
this.stateService
|
this.stateService,
|
||||||
|
this.environmentService
|
||||||
);
|
);
|
||||||
|
|
||||||
this.tabsBackground = new TabsBackground(this, this.notificationBackground);
|
this.tabsBackground = new TabsBackground(this, this.notificationBackground);
|
||||||
|
|
Loading…
Reference in New Issue