feat: 交付官方 Docker 运行时,外观改背景图并下线自定义 CSS/JS

站点/后台分轨背景与用户列表排序一并落地;生产 CORS 改走 SITE_URL,健康检查带版本号。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-18 05:27:33 +08:00
parent 5f7193042f
commit d784b0ea7a
68 changed files with 2588 additions and 768 deletions

View File

@@ -18,6 +18,7 @@ import type { User } from "@/lib/api";
import { getMeCached, getPublicSettingsCached } from "@/lib/serverData";
import { TOKEN_COOKIE, authCookieHeader } from "@/lib/cookies";
import { accentStyleCSS } from "@/lib/theme";
import { bgConfigFromSettings, bgStyleCSS } from "@/lib/bg";
import { motionConfigFromSettings } from "@/lib/motion";
// 构建期下载并自托管字体:同源加载 + 自动 preload + fallback 度量校正,
@@ -83,12 +84,14 @@ export default async function RootLayout({
const settings = await getPublicSettingsCached();
const accent = settings.accent;
const accentCSS = accentStyleCSS(accent || "");
const customCSS = (settings.custom_css || "").trim();
const customJS = (settings.custom_js || "").trim();
const bgCfg = bgConfigFromSettings(settings);
const bgCSS = bgStyleCSS(bgCfg);
const motionCfg = motionConfigFromSettings(settings);
const motionHtmlClass = [
!motionCfg.ui_animations ? "j13-reduce-motion" : "",
motionCfg.ui_animations && !motionCfg.anim_chrome ? "j13-reduce-chrome" : "",
bgCfg.bg_site_url ? "j13-has-site-bg" : "",
bgCfg.bg_admin_url ? "j13-has-admin-bg" : "",
]
.filter(Boolean)
.join(" ");
@@ -108,6 +111,7 @@ export default async function RootLayout({
return (
<html
lang="zh-CN"
data-j13-chrome={isAdmin ? "admin" : "site"}
className={`${theme === "dark" ? "dark" : ""} ${motionHtmlClass} ${jakarta.variable} ${notoSC.variable} ${jetbrainsMono.variable}`.trim()}
>
<body className="min-h-screen flex flex-col">
@@ -119,11 +123,11 @@ export default async function RootLayout({
dangerouslySetInnerHTML={{ __html: accentCSS }}
/>
) : null}
{customCSS ? (
{bgCSS ? (
<style
id="j13-custom-css"
data-custom-css-source="ssr"
dangerouslySetInnerHTML={{ __html: customCSS }}
id="j13-bg-vars"
data-bg-source="ssr"
dangerouslySetInnerHTML={{ __html: bgCSS }}
/>
) : null}
<a href="#main" className="skip-link">
@@ -156,12 +160,9 @@ export default async function RootLayout({
<Toaster />
<TipHost />
<AccountGuard />
<ThemeSync initialAccent={accent || ""} initialCustomCSS={customCSS} />
<ThemeSync initialAccent={accent || ""} initialBg={bgCfg} />
<VisitBeacon />
<RealtimeProvider userId={user ? user.id : null} />
{customJS ? (
<script id="j13-custom-js" dangerouslySetInnerHTML={{ __html: customJS }} />
) : null}
</body>
</html>
);