feat(frontend): add theme real-time sync feature

1. 新增ThemeSync组件实现站点主题色无刷新同步
2. 给获取站点设置的接口添加no-store缓存策略确保拿到最新配置
3. 调整主题应用代码的属性设置顺序避免逻辑问题
This commit is contained in:
2026-09-15 05:04:25 +08:00
parent a7b6421840
commit 29db9ae9b5
4 changed files with 75 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import Header from "@/components/Header";
import Footer from "@/components/Footer";
import Toaster from "@/components/Toaster";
import AccountGuard from "@/components/AccountGuard";
import ThemeSync from "@/components/ThemeSync";
import type { User } from "@/lib/api";
import { getMeCached, getPublicSettingsCached } from "@/lib/serverData";
import { TOKEN_COOKIE, REFRESH_COOKIE, authCookieHeader } from "@/lib/cookies";
@@ -104,6 +105,7 @@ export default async function RootLayout({
<Footer />
<Toaster />
<AccountGuard />
<ThemeSync initialAccent={accent || ""} />
</body>
</html>
);