Enrollment + almost all auth

This commit is contained in:
mdares
2026-01-03 20:18:39 +00:00
parent 0ad2451dd4
commit a0ed517047
40 changed files with 3559 additions and 31 deletions

14
lib/appUrl.ts Normal file
View File

@@ -0,0 +1,14 @@
export function getBaseUrl(req?: Request) {
const envUrl = process.env.APP_BASE_URL || process.env.NEXT_PUBLIC_APP_URL;
if (envUrl) return String(envUrl).replace(/\/+$/, "");
if (!req) return "http://localhost:3000";
const forwardedProto = req.headers.get("x-forwarded-proto");
const proto = forwardedProto ? forwardedProto.split(",")[0].trim() : new URL(req.url).protocol.replace(":", "");
const host =
req.headers.get("x-forwarded-host") ||
req.headers.get("host") ||
new URL(req.url).host;
return `${proto}://${host}`;
}