refactor: 完成静态网站转换,移除所有 CMS 和动态功能

- 删除数据库相关代码 (src/db/)
- 删除 API 路由 (src/app/api/)
- 删除认证相关代码 (src/lib/auth/, src/providers/)
- 删除监控和安全中间件 (src/lib/security/, src/lib/monitoring/)
- 删除 hooks (use-news, use-products, use-services)
- 更新组件为静态数据源
- 添加 nginx 静态配置和部署脚本
- 添加 static-link 组件
This commit is contained in:
张翔
2026-04-21 07:53:56 +08:00
parent cd1d6aa28a
commit 6403489954
197 changed files with 654 additions and 24762 deletions
-53
View File
@@ -1,53 +0,0 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
export function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
if (pathname.startsWith('/api/auth')) {
return NextResponse.next();
}
if (pathname.startsWith('/api/admin')) {
return NextResponse.next();
}
if (pathname.startsWith('/api/content')) {
return NextResponse.next();
}
const legacyApiPaths = [
'/api/config',
'/api/health',
];
const isLegacyApi = legacyApiPaths.some(path =>
pathname.startsWith(path) && !pathname.includes('/v1/') && !pathname.includes('/v2/')
);
if (isLegacyApi) {
const url = request.nextUrl.clone();
url.pathname = pathname.replace('/api/', '/api/v1/');
return NextResponse.rewrite(url);
}
if (pathname.startsWith('/api/docs') || pathname === '/api-docs') {
const response = NextResponse.next();
response.headers.set('X-API-Version', 'none');
return response;
}
const versionMatch = pathname.match(/\/api\/v(\d+)\//);
if (versionMatch) {
const response = NextResponse.next();
response.headers.set('X-API-Version', `v${versionMatch[1]}`);
return response;
}
return NextResponse.next();
}
export const config = {
matcher: '/api/:path*',
};