Spaces:
Running
Running
Refactor Dockerfile and frontend to enhance Firebase configuration handling. Update build process to utilize runtime secrets for Firebase variables, ensuring proper integration and dynamic loading in the Next.js application. Modify admin dashboard and other components to accommodate new configuration logic.
05e7451 Download frontend/src/lib/adminPath.ts from dev-scezui/tistru: direct link, hf CLI and curl.
- Browser
- Download file 882 Bytes
-
https://huggingface.co/spaces/dev-scezui/tistru/resolve/main/frontend/src/lib/adminPath.ts
- Command line
-
hf download hf://spaces/dev-scezui/tistru/frontend/src/lib/adminPath.ts
-
curl -L -o adminPath.ts https://huggingface.co/spaces/dev-scezui/tistru/resolve/main/frontend/src/lib/adminPath.ts
882 Bytes
| import { publicEnv } from "./publicEnv"; | |
| function readAdminPathSecret(): string { | |
| // Client: runtime-config.js (HF/Docker) or NEXT_PUBLIC_* from next dev. | |
| if (typeof window !== "undefined") { | |
| return publicEnv("NEXT_PUBLIC_ADMIN_PATH_SECRET"); | |
| } | |
| // Server: prefer non-NEXT_PUBLIC so HF/Docker runtime env is not build-inlined. | |
| const env = process.env as Record<string, string | undefined>; | |
| return ( | |
| env.ADMIN_PATH_SECRET?.trim() || | |
| env.NEXT_PUBLIC_ADMIN_PATH_SECRET?.trim() || | |
| "" | |
| ); | |
| } | |
| /** Login/admin UI path segment from env (literal URL, not encoded). */ | |
| export function adminPathSlug(): string { | |
| const secret = readAdminPathSecret(); | |
| if (!secret) return ""; | |
| return secret.replace(/^\/+|\/+$/g, ""); | |
| } | |
| export function isAdminSlug(slug: string): boolean { | |
| const expected = adminPathSlug(); | |
| return Boolean(expected) && slug === expected; | |
| } | |