Your Name 5568325a0d
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
feat: add configurable home animation module
2026-03-24 22:53:16 +08:00

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",
},
},
);
}
}