added default fallback for prod

This commit is contained in:
user
2026-03-28 19:27:13 +02:00
parent 92deee1b2e
commit ce13ad8124
4 changed files with 12 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
import { env } from "$env/dynamic/public";
export const WS_SCRCPY_URL = env.PUBLIC_WS_SCRCPY_SVC_URL ?? "";
export const WS_SCRCPY_URL =
env.PUBLIC_WS_SCRCPY_SVC_URL ?? "https://iotam-ws-scrcpy.snapyra.com";
export const TRANSITION_COLORS = "transition-colors duration-150 ease-in-out";
export const TRANSITION_ALL = "transition-all duration-150 ease-in-out";

View File

@@ -47,7 +47,8 @@ export const secondaryNavTree = [
},
] as AppSidebarItem[];
export const WS_SCRCPY_URL = env.PUBLIC_WS_SCRCPY_SVC_URL;
export const WS_SCRCPY_URL =
env.PUBLIC_WS_SCRCPY_SVC_URL ?? "https://iotam-ws-scrcpy.snapyra.com";
export const COMPANY_NAME = "SaaS Template";
export const WEBSITE_URL = "https://company.com";

View File

@@ -8,7 +8,7 @@
import { Input } from "$lib/components/ui/input";
import { Label } from "$lib/components/ui/label";
import * as Table from "$lib/components/ui/table";
import { env } from "$env/dynamic/public";
import { PUBLIC_FRONTEND_URL } from "$env/static/public";
import MaxWidthWrapper from "$lib/components/molecules/max-width-wrapper.svelte";
import { mainNavTree } from "$lib/core/constants";
import { linkVM } from "$lib/domains/link/link.vm.svelte";
@@ -51,7 +51,7 @@
}
function buildPublicLink(token: string): string {
const base = env.PUBLIC_FRONTEND_URL?.trim() || "/";
const base = PUBLIC_FRONTEND_URL?.trim() || "/";
const origin = typeof window !== "undefined" ? window.location.origin : "http://localhost";
const url = new URL(base, origin);
url.searchParams.set("token", token);

View File

@@ -84,3 +84,9 @@ Update rule:
### 11 — Admin Link Copy Full URL
- Refactored admin links-page copy action to copy full public frontend access URLs (`PUBLIC_FRONTEND_URL?token=...`) instead of raw tokens.
### 12 — Main App Production Env Access Fix
- Replaced client-facing `$env/dynamic/public` usage with `$env/static/public` in shared constants and links page code.
- Fixed production crash path where browser bundle attempted to read runtime `env` from an undefined object during hydration/update.
- Kept behavior unchanged for `PUBLIC_WS_SCRCPY_SVC_URL` and `PUBLIC_FRONTEND_URL` consumers while making access compile-time safe.