DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix: keep NEXT_PUBLIC_AUTH_ENABLED out of the minifier constant-fold
Ilia Avdeeva8d6545f37b3
diff --git a/web/lib/api.ts b/web/lib/api.tsindex 403905f1d..62bbb1fc6 100644--- a/web/lib/api.ts+++ b/web/lib/api.ts@@ -131,7 +131,12 @@ export function wsUrl(path: string): string {return `${normalizedBase}${normalizedPath}`;}-const AUTH_ENABLED = process.env.NEXT_PUBLIC_AUTH_ENABLED === "true";+// Evaluate the build-time flag at runtime (not a ``=== "true"`` compare) so the+// Docker ``__NEXT_PUBLIC_AUTH_ENABLED_PLACEHOLDER__`` token survives minification+// and ``start-frontend.sh`` can rewrite it on startup. See lib/auth.ts.+const AUTH_ENABLED = /^(1|true|yes|on)$/i.test(+ (process.env.NEXT_PUBLIC_AUTH_ENABLED ?? "").trim(),+);/*** Authenticated fetch wrapper. Behaves identically to `fetch` but automaticallydiff --git a/web/lib/auth.ts b/web/lib/auth.tsindex 4c42868b1..64438a28b 100644--- a/web/lib/auth.ts+++ b/web/lib/auth.ts@@ -1,6 +1,15 @@import { apiFetch, apiUrl } from "@/lib/api";-export const AUTH_ENABLED = process.env.NEXT_PUBLIC_AUTH_ENABLED === "true";+// ``NEXT_PUBLIC_AUTH_ENABLED`` is inlined at build time and, in the Docker+// image, baked as the ``__NEXT_PUBLIC_AUTH_ENABLED_PLACEHOLDER__`` token that+// ``start-frontend.sh`` rewrites on container start. A ``=== "true"`` literal+// comparison gets constant-folded by the minifier to ``false`` — which strips+// the placeholder and permanently breaks the runtime rewrite. Evaluating the+// raw value with a runtime regex keeps the placeholder string in the bundle+// (mirroring how ``lib/api.ts`` handles the API base placeholder).+export const AUTH_ENABLED = /^(1|true|yes|on)$/i.test(+ (process.env.NEXT_PUBLIC_AUTH_ENABLED ?? "").trim(),+);export interface AuthStatus {enabled: boolean;