- 看板首页 / :Zen Minimal × Future Organic 融合(用户裁定),编号索引+柔光光晕+GSAP克制动效,白皮书气质 - 素材库首页整体迁移至 /materials(含colocated测试),全站返回素材库链接同步清扫 - 组织架构页上移为顶层 /organization(保留云采石场契约注释),旧路径 /admin/org 服务端跳转;API 迁移 /api/organization(逻辑零改动) - 后台删除组织架构跳转按钮(白屏问题源头消失);middleware 增 /materials 登录门、/organization 管理员门 - 品牌统一:浅色顶栏用 loginLogoUrl(深色图案版),标题「由壹点·品牌中心」;字体自托管 @fontsource - 可访问性收尾(评审fix项):全文对比度过WCAG、焦点环、加载骨架防闪灰、移动端状态可见、::selection - PRODUCT.md/DESIGN.md 记录方向契约;测试基线 1815 通过/6 既有失败(无劣化)
70 lines
2.4 KiB
TypeScript
70 lines
2.4 KiB
TypeScript
import type { Metadata, Viewport } from 'next'
|
||
import '@fontsource/noto-sans-sc/700.css'
|
||
import '@fontsource/noto-sans-sc/900.css'
|
||
import '@fontsource/space-grotesk/500.css'
|
||
import '@fontsource/space-grotesk/600.css'
|
||
import '@fontsource/space-grotesk/700.css'
|
||
import './globals.css'
|
||
import Providers from './providers'
|
||
import { prisma } from '@/lib/prisma'
|
||
|
||
export const viewport: Viewport = {
|
||
width: 'device-width',
|
||
initialScale: 1,
|
||
viewportFit: 'cover',
|
||
}
|
||
|
||
async function getSystemSettings() {
|
||
try {
|
||
// 直接从数据库查询,避免网络请求超时问题
|
||
const settings = await prisma.systemSettings.findFirst({
|
||
select: {
|
||
siteName: true,
|
||
}
|
||
})
|
||
return settings
|
||
} catch (error) {
|
||
console.error('Failed to fetch system settings:', error)
|
||
}
|
||
return null
|
||
}
|
||
|
||
export async function generateMetadata(): Promise<Metadata> {
|
||
const settings = await getSystemSettings()
|
||
|
||
return {
|
||
title: settings?.siteName || '由壹点3D素材',
|
||
description: '3D素材分享平台',
|
||
icons: {
|
||
icon: '/api/favicon',
|
||
shortcut: '/api/favicon',
|
||
apple: '/api/favicon',
|
||
},
|
||
}
|
||
}
|
||
|
||
export default function RootLayout({
|
||
children,
|
||
}: {
|
||
children: React.ReactNode
|
||
}) {
|
||
return (
|
||
<html lang="zh-CN">
|
||
<head>
|
||
{/* 禁用浏览器缓存,确保用户总是获取最新代码 */}
|
||
<meta httpEquiv="Cache-Control" content="no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" />
|
||
<meta httpEquiv="Pragma" content="no-cache" />
|
||
<meta httpEquiv="Expires" content="0" />
|
||
{/* 允许 blob URL 在 HTTP 页面上使用(解决 HTTPS 警告) */}
|
||
{/* 注意:frame-ancestors 只能通过 HTTP 响应头设置,不能通过 meta 标签 */}
|
||
<meta httpEquiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval' blob: data: http: https: ws: wss:; img-src 'self' 'unsafe-inline' blob: data: http: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: https://g.alicdn.com; style-src 'self' 'unsafe-inline'; connect-src 'self' blob: data: http: https: ws: wss:; media-src 'self' blob: data: http: https:; font-src 'self' data: http: https:; object-src 'none'; base-uri 'self'; form-action 'self';" />
|
||
</head>
|
||
<body className="font-sans antialiased">
|
||
<Providers>
|
||
{children}
|
||
</Providers>
|
||
</body>
|
||
</html>
|
||
)
|
||
}
|