Open History to see the last commit
1import type { DesktopAppBranding } from "@t3tools/contracts";
2
3function readInjectedDesktopAppBranding(): DesktopAppBranding | null {
4 if (typeof window === "undefined") {
5 return null;
6 }
7
8 return window.desktopBridge?.getAppBranding?.() ?? null;
9}
10
11const injectedDesktopAppBranding = readInjectedDesktopAppBranding();
12const hostedAppChannel = import.meta.env.VITE_HOSTED_APP_CHANNEL?.trim().toLowerCase();
13
14export const HOSTED_APP_CHANNEL =
15 hostedAppChannel === "latest" || hostedAppChannel === "nightly" ? hostedAppChannel : null;
16export const HOSTED_APP_CHANNEL_LABEL =
17 HOSTED_APP_CHANNEL === "nightly" ? "Nightly" : HOSTED_APP_CHANNEL === "latest" ? "Latest" : null;
18export const APP_BASE_NAME = injectedDesktopAppBranding?.baseName ?? "T3 Code";
19export const APP_STAGE_LABEL =
20 injectedDesktopAppBranding?.stageLabel ??
21 HOSTED_APP_CHANNEL_LABEL ??
22 (import.meta.env.DEV ? "Dev" : "Bscholar");
23export const APP_DISPLAY_NAME =
24 injectedDesktopAppBranding?.displayName ?? `${APP_BASE_NAME} (${APP_STAGE_LABEL})`;
25export const APP_VERSION = import.meta.env.APP_VERSION || "0.0.0";