Add authenticated login and SSO protection

This commit is contained in:
inman
2026-05-29 15:54:13 +08:00
parent e36f28a668
commit 0648874801
50 changed files with 1853 additions and 63 deletions

View File

@@ -1,10 +1,12 @@
import { getApiSettings, saveApiSettings } from "@/lib/server/app-settings";
import { jsonError, jsonOk, readJsonBody } from "@/lib/server/api";
import { requireAppUser } from "@/lib/server/auth/current-user";
export const runtime = "nodejs";
export async function GET() {
try {
await requireAppUser();
return jsonOk(await getApiSettings());
} catch (error) {
return jsonError(error, 500);
@@ -13,6 +15,7 @@ export async function GET() {
export async function POST(request: Request) {
try {
await requireAppUser();
const body = await readJsonBody<{ values?: Record<string, unknown> }>(request);
return jsonOk(await saveApiSettings(body.values || {}));
} catch (error) {