40 lines
916 B
TypeScript
40 lines
916 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { getSystemSetting } from "@/lib/db/queries";
|
|
import {
|
|
HOME_CHAT_ANIMATION_CONFIG_KEY,
|
|
resolvePublicHomeChatAnimationConfig,
|
|
} from "@/lib/home/home-animation-config";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET() {
|
|
try {
|
|
const setting = await getSystemSetting({
|
|
key: HOME_CHAT_ANIMATION_CONFIG_KEY,
|
|
}).catch(() => null);
|
|
|
|
const payload = resolvePublicHomeChatAnimationConfig(setting?.value);
|
|
|
|
return NextResponse.json(payload, {
|
|
headers: {
|
|
"Cache-Control": "no-store, max-age=0",
|
|
},
|
|
});
|
|
} catch {
|
|
return NextResponse.json(
|
|
{
|
|
enabled: false,
|
|
fileName: "",
|
|
htmlContent: "",
|
|
updatedAt: null,
|
|
usesDefaultFallback: false,
|
|
},
|
|
{
|
|
headers: {
|
|
"Cache-Control": "no-store, max-age=0",
|
|
},
|
|
},
|
|
);
|
|
}
|
|
}
|