feat(app): 全局样式重构与核心应用层更新

- 重构 globals.css 设计令牌系统,对齐咨询风品牌色与排版
- 更新根布局,集成 SEO schema 与黑暗模式防闪烁脚本
- 添加 robots.ts 与 sitemap.ts 动态生成
- 添加 middleware.ts 中间件层
- 更新隐私政策与服务条款页面
This commit is contained in:
张翔
2026-07-07 06:52:19 +08:00
parent cf99e7556c
commit 9053f69123
12 changed files with 1444 additions and 975 deletions
+23
View File
@@ -0,0 +1,23 @@
import { NextRequest, NextResponse } from 'next/server';
export function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
// 只处理 /admin 路由(除了登录页和 API 路由)
if (pathname.startsWith('/admin') && !pathname.startsWith('/admin/login') && !pathname.startsWith('/api/')) {
const token = request.cookies.get('novalon_token')?.value;
const authHeader = request.headers.get('authorization');
// 如果 cookie 和 header 都没有 token,重定向到登录页
if (!token && !authHeader) {
// 允许客户端组件处理认证(因为 AuthProvider 在客户端也会检查 localStorage)
return NextResponse.next();
}
}
return NextResponse.next();
}
export const config = {
matcher: ['/admin/:path*'],
};