feat: add local auth billing and usage management

This commit is contained in:
inman committed 2026-08-12 12:13:06 +08:00
1 parent f642b5e71f
commit 196fdde83f
119 files changed
+15695 -2650

No files matched your search

+3 -21
View File
@@ -1,25 +1,7 @@
import { getAuthRuntimeConfig } from "@/lib/auth/config";
import { jsonError } from "@/lib/server/api";
import { jsonOk } from "@/lib/server/api";
export const runtime = "nodejs";
export async function GET(request: Request) {
try {
const config = getAuthRuntimeConfig();
if (!config.authBaseUrl) throw new Error("认证中心地址未配置。");
const randomStr = new URL(request.url).searchParams.get("randomStr")?.trim();
if (!randomStr) throw new Error("randomStr is required.");
const response = await fetch(`${config.authBaseUrl}/code/image?randomStr=${encodeURIComponent(randomStr)}`, {
cache: "no-store"
});
if (!response.ok) throw new Error(`验证码获取失败:${response.status}`);
return new Response(new Uint8Array(await response.arrayBuffer()), {
headers: {
"Content-Type": response.headers.get("content-type") || "image/png",
"Cache-Control": "no-store"
}
});
} catch (error) {
return jsonError(error, 500);
}
export async function GET() {
return jsonOk({ enabled: false, message: "平台账号登录不使用外部验证码。" });
}