feat: add local auth billing and usage management
This commit is contained in:
1 parent
f642b5e71f
commit
196fdde83f
119 files changed
+15695
-2650
No files matched your search
@@ -1,12 +1,12 @@
|
||||
import { getApiSettings, saveApiSettings } from "@/lib/server/app-settings";
|
||||
import { jsonError, jsonOk, readJsonBody } from "@/lib/server/api";
|
||||
import { requireAdminUser } from "@/lib/server/auth/current-user";
|
||||
import { requireSuperAdminUser } from "@/lib/server/auth/current-user";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
await requireAdminUser();
|
||||
await requireSuperAdminUser();
|
||||
return jsonOk(await getApiSettings());
|
||||
} catch (error) {
|
||||
return jsonError(error, 500);
|
||||
@@ -15,7 +15,7 @@ export async function GET() {
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
await requireAdminUser();
|
||||
await requireSuperAdminUser();
|
||||
const body = await readJsonBody<{ values?: Record<string, unknown> }>(request);
|
||||
return jsonOk(await saveApiSettings(body.values || {}));
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user