Add login gate, calculation history, and AI markdown download.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { cookies } from "next/headers";
|
||||
import { isAuthEnabled } from "@/lib/auth/config";
|
||||
import { getSessionUsername, SESSION_COOKIE } from "@/lib/auth/session";
|
||||
|
||||
export async function GET() {
|
||||
if (!isAuthEnabled()) {
|
||||
return NextResponse.json({ authEnabled: false, loggedIn: true });
|
||||
}
|
||||
|
||||
const token = (await cookies()).get(SESSION_COOKIE)?.value;
|
||||
const username = await getSessionUsername(token);
|
||||
|
||||
return NextResponse.json({
|
||||
authEnabled: true,
|
||||
loggedIn: !!username,
|
||||
username: username ?? undefined,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user