add auth and nicer styling

This commit is contained in:
2025-08-11 01:48:15 +02:00
parent bb3ad1e4b9
commit 0d95b642cd
11 changed files with 412 additions and 115 deletions

View File

@@ -0,0 +1,26 @@
import { NextRequest, NextResponse } from "next/server";
import { getSession } from "@/lib/auth";
export async function POST(req: NextRequest) {
try {
const { password } = await req.json();
if (password !== process.env.PASSWORD) {
return NextResponse.json(
{ error: "Invalid password" },
{ status: 401 }
);
}
const session = await getSession();
session.authenticated = true;
await session.save();
return NextResponse.json({ success: true });
} catch (error) {
return NextResponse.json(
{ error: "Authentication failed" },
{ status: 500 }
);
}
}