Files
zhuiguang-ai/next.config.mjs
T
ZhuiGuangAI Dev e263e28c81 全面审查优化: 43项修复(安全/性能/可靠性)+ 文档更新
🔴 P0 安全: .env入gitignore, CSP/HSTS, Logo安全(5MB限制+SVG消毒+SHA256), middleware权限收紧(VIP不能访问admin), 发布去重, GitHub认证, 删除危险API, skill-discoverer绕过审核修复, prisma默认连接修复
🔴 P0 可靠性: deepseek/github超时重试, 脚本层DeepSeek保护, 脚本启动验证, OAuth竞态修复
🔴 P0 性能: skill-discoverer N+1优化(↓94%), 后台API分页限制, getUserStats聚合优化
🟡 P1: 分类动态加载, 星级字段统一, fetch-logos并发Bug修复, 批量发布冲突不删除, check-tools重试, 前端空指针修复(13处), logo-fetcher日志, rate-limit清理, 公开API缓存
2026-05-26 00:30:36 +08:00

87 lines
2.3 KiB
JavaScript

/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**",
},
],
minimumCacheTTL: 3600,
formats: ["image/avif", "image/webp"],
},
compress: true,
poweredByHeader: false,
reactStrictMode: true,
webpack: (config, { isServer }) => {
config.watchOptions = {
...config.watchOptions,
ignored: [
"**/node_modules/**",
"**/.git/**",
"**/System Volume Information/**",
"**/DumpStack.log.tmp",
"**/pagefile.sys",
],
poll: false,
};
return config;
},
onDemandEntries: {
maxInactiveAge: 60 * 1000,
pagesBufferLength: 5,
},
experimental: {
optimizeCss: false,
},
headers: async () => {
const isDev = process.env.NODE_ENV === "development";
const headers = [
{
source: "/api/:path*",
headers: [
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "X-Frame-Options", value: "DENY" },
{ key: "X-XSS-Protection", value: "1; mode=block" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
],
},
{
source: "/:path*",
headers: [
{ key: "Strict-Transport-Security", value: "max-age=31536000; includeSubDomains" },
{ key: "Content-Security-Policy", value: "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' https: data:; font-src 'self'; connect-src 'self' https:; frame-ancestors 'none'" },
{ key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()" },
],
},
{
source: "/logos/:path*",
headers: [
{ key: "Cache-Control", value: isDev ? "no-cache" : "public, max-age=86400, immutable" },
],
},
];
if (isDev) {
headers.push({
source: "/(.*)",
headers: [
{ key: "Cache-Control", value: "no-store, no-cache, must-revalidate, proxy-revalidate" },
],
});
} else {
headers.push({
source: "/_next/static/:path*",
headers: [
{ key: "Cache-Control", value: "public, max-age=31536000, immutable" },
],
});
}
return headers;
},
};
export default nextConfig;