feat: add admin accounts and image templates

This commit is contained in:
inman
2026-07-03 11:25:25 +08:00
parent d98e58adfa
commit c3ea9f0eb1
61 changed files with 7016 additions and 199 deletions

View File

@@ -1,4 +1,5 @@
import { jsonError, jsonOk } from "@/lib/server/api";
import { requireAdminUser } from "@/lib/server/auth/current-user";
import { appLogFilePath, appLogMaxBytes, clearAppLogs, listAppLogs, type AppLogLevel } from "@/lib/server/log-manager";
export const runtime = "nodejs";
@@ -6,6 +7,7 @@ export const dynamic = "force-dynamic";
export async function GET(request: Request) {
try {
await requireAdminUser();
const url = new URL(request.url);
const level = parseLevel(url.searchParams.get("level"));
const q = url.searchParams.get("q") || undefined;
@@ -27,6 +29,7 @@ export async function GET(request: Request) {
export async function DELETE(request: Request) {
try {
await requireAdminUser();
await clearAppLogs();
return jsonOk({ ok: true });
} catch (error) {