Convert settings page to server component with server actions

Replace client-side data fetching with server-side queries and server
actions, eliminating 3 API route files. Extract page into granular
client components (account, integrations, server, webhook card) with
optimistic updates. Rename sections: Media Servers → Integrations,
Administration → Server. Add admin badge to account section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 09:32:18 -05:00
co-authored by Claude Opus 4.6
parent 83e2bc5143
commit 8487c3d7b1
11 changed files with 864 additions and 800 deletions
-30
View File
@@ -1,30 +0,0 @@
import { headers } from "next/headers";
import { NextResponse } from "next/server";
import { auth } from "@/lib/auth/server";
import { getSetting, setSetting } from "@/lib/services/settings";
export async function GET() {
const session = await auth.api.getSession({ headers: await headers() });
if (!session)
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
if (session.user.role !== "admin")
return NextResponse.json({ error: "Forbidden" }, { status: 403 });
const registrationOpen = (await getSetting("registrationOpen")) === "true";
return NextResponse.json({ registrationOpen });
}
export async function POST(request: Request) {
const session = await auth.api.getSession({ headers: await headers() });
if (!session)
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
if (session.user.role !== "admin")
return NextResponse.json({ error: "Forbidden" }, { status: 403 });
const body = await request.json();
if (typeof body.registrationOpen === "boolean") {
await setSetting("registrationOpen", String(body.registrationOpen));
}
return NextResponse.json({ success: true });
}