31 lines
779 B
TypeScript
31 lines
779 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { getSystemSetting } from "@/lib/db/queries";
|
|
import {
|
|
STYLE_PRO_CONFIG_KEY,
|
|
normalizeStyleProConfig,
|
|
toPublicStyleProConfig,
|
|
} from "@/lib/style-pro/config";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET() {
|
|
try {
|
|
const setting = await getSystemSetting({ key: STYLE_PRO_CONFIG_KEY }).catch(
|
|
() => null
|
|
);
|
|
const config = normalizeStyleProConfig(setting?.value);
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
config: toPublicStyleProConfig(config),
|
|
});
|
|
} catch (error) {
|
|
console.error("[Style Pro Config] Failed:", error);
|
|
return NextResponse.json(
|
|
{ success: false, error: "获取风格化 PRO 配置失败" },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|
|
|