17 lines
462 B
TypeScript
17 lines
462 B
TypeScript
export const dynamic = "force-dynamic";
|
|||
|
|
|
||
|
|
import { requireAuth } from "@/lib/auth/guard";
|
||
|
|
import { getConfig } from "@/lib/config/load";
|
||
|
|
|
||
|
|
export async function GET(request: Request) {
|
||
|
|
const { config } = getConfig();
|
||
|
|
const auth = await requireAuth(request);
|
||
|
|
|
||
|
|
return Response.json({
|
||
|
|
authRequired: config.auth.enabled,
|
||
|
|
authenticated: auth.authenticated,
|
||
|
|
user:
|
||
|
|
auth.authenticated && auth.identity ? { username: auth.identity } : null,
|
||
|
|
});
|
||
|
|
}
|