web: use version family subdomain for in-app doc links

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-12-22 17:03:08 +01:00
parent 4c133b957c
commit e4e7a112e3
11 changed files with 42 additions and 15 deletions

View File

@ -7,6 +7,9 @@ export interface GlobalAuthentik {
};
config: Config;
tenant: CurrentTenant;
versionFamily: string;
versionSubdomain: string;
build: string;
}
export interface AuthentikWindow {
@ -16,3 +19,12 @@ export interface AuthentikWindow {
export function globalAK(): GlobalAuthentik | undefined {
return (window as unknown as AuthentikWindow).authentik;
}
export function docLink(path: string): string {
const ak = globalAK();
// Default case or beta build which should always point to latest
if (!ak || ak.build !== "") {
return `https://goauthentik.io${path}`;
}
return `https://${ak.versionSubdomain}.goauthentik.io${path}`;
}