29 lines
951 B
TypeScript
29 lines
951 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { auth } from "@/app/(auth)/auth";
|
|
import { getSystemSetting } from "@/lib/db/queries";
|
|
import {
|
|
ENHANCE_PRO_KREA_SETTING_KEY,
|
|
normalizeEnhanceProKreaConfig,
|
|
sanitizeEnhanceProKreaConfigForClient,
|
|
} from "@/lib/enhance-pro/config";
|
|
|
|
export async function GET() {
|
|
try {
|
|
const session = await auth();
|
|
if (!session?.user?.id) {
|
|
return NextResponse.json({ error: "未授权,请先登录" }, { status: 401 });
|
|
}
|
|
|
|
const setting = await getSystemSetting({ key: ENHANCE_PRO_KREA_SETTING_KEY });
|
|
const config = normalizeEnhanceProKreaConfig(setting?.value);
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
config: sanitizeEnhanceProKreaConfigForClient(config),
|
|
});
|
|
} catch (error) {
|
|
console.error("[Enhance Pro Config] 获取配置失败:", error);
|
|
return NextResponse.json({ error: "获取图像增强 Pro 配置失败" }, { status: 500 });
|
|
}
|
|
}
|