mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
fix
This commit is contained in:
parent
90fc99b7bf
commit
90d795cc9c
@ -396,11 +396,14 @@ function createInternalApp(apiBaseUrl: string, anonymousRefreshToken?: string) {
|
||||
function envVarsForProject(project: RemoteDevelopmentEnvironmentProject): Record<string, string> {
|
||||
const brands = ["HEXCLAVE", "STACK"];
|
||||
const publicPrefixes = ["", "NEXT_PUBLIC_", "VITE_", "EXPO_PUBLIC_"];
|
||||
const dashboardUrl = getPublicEnvVar("NEXT_PUBLIC_STACK_DASHBOARD_URL");
|
||||
|
||||
const publicValues: Record<string, string> = {
|
||||
PROJECT_ID: project.projectId,
|
||||
PUBLISHABLE_CLIENT_KEY: project.publishableClientKey,
|
||||
API_URL: project.apiBaseUrl,
|
||||
IS_REMOTE_DEVELOPMENT_ENVIRONMENT: "true",
|
||||
...(dashboardUrl == null ? {} : { DASHBOARD_URL: dashboardUrl }),
|
||||
};
|
||||
const secretValues: Record<string, string> = {
|
||||
SECRET_SERVER_KEY: project.secretServerKey,
|
||||
|
||||
@ -28,6 +28,9 @@ const envVarsConfig: Record<string, { allowPublic?: boolean, deprecatedLegacyNam
|
||||
allowPublic: true,
|
||||
deprecatedLegacyNames: ["HEXCLAVE_URL", "STACK_URL"],
|
||||
},
|
||||
HEXCLAVE_DASHBOARD_URL: {
|
||||
allowPublic: true,
|
||||
},
|
||||
HEXCLAVE_HOSTED_HANDLER_DOMAIN_SUFFIX: {
|
||||
allowPublic: true,
|
||||
},
|
||||
@ -46,6 +49,9 @@ const envVarsConfig: Record<string, { allowPublic?: boolean, deprecatedLegacyNam
|
||||
HEXCLAVE_IS_LOCAL_EMULATOR: {
|
||||
allowPublic: true,
|
||||
},
|
||||
HEXCLAVE_IS_REMOTE_DEVELOPMENT_ENVIRONMENT: {
|
||||
allowPublic: true,
|
||||
},
|
||||
HEXCLAVE_POSTHOG_KEY: {
|
||||
allowPublic: true,
|
||||
},
|
||||
|
||||
@ -190,8 +190,22 @@ function resolveApiBaseUrl(app: StackClientApp<true>): string {
|
||||
return getBaseUrl(opts.baseUrl);
|
||||
}
|
||||
|
||||
function resolveConfiguredLocalDashboardBaseUrl(): string | undefined {
|
||||
const dashboardUrl = envVars.HEXCLAVE_DASHBOARD_URL;
|
||||
if (dashboardUrl == null || !isLocalhost(dashboardUrl)) return undefined;
|
||||
try {
|
||||
return new URL(dashboardUrl).origin;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function shouldShowDashboardTab(app: StackClientApp<true>): boolean {
|
||||
return envVars.HEXCLAVE_IS_LOCAL_EMULATOR === "true" && isLocalhost(resolveApiBaseUrl(app));
|
||||
return (
|
||||
envVars.HEXCLAVE_IS_LOCAL_EMULATOR === "true" && isLocalhost(resolveApiBaseUrl(app))
|
||||
) || (
|
||||
envVars.HEXCLAVE_IS_REMOTE_DEVELOPMENT_ENVIRONMENT === "true" && resolveConfiguredLocalDashboardBaseUrl() != null
|
||||
);
|
||||
}
|
||||
|
||||
function getTabsForApp(app: StackClientApp<true>): { id: TabId; label: string; icon: string }[] {
|
||||
@ -222,7 +236,7 @@ function deriveDashboardBaseUrl(apiBaseUrl: string): string {
|
||||
}
|
||||
|
||||
function resolveDashboardUrl(app: StackClientApp<true>): string {
|
||||
const base = deriveDashboardBaseUrl(resolveApiBaseUrl(app));
|
||||
const base = resolveConfiguredLocalDashboardBaseUrl() ?? deriveDashboardBaseUrl(resolveApiBaseUrl(app));
|
||||
return `${base}/projects/${encodeURIComponent(app.projectId)}`;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user