feat: 大量优化和bug修复

This commit is contained in:
2026-05-23 22:23:29 +08:00
parent 92b063c4c4
commit fc71e924e7
39 changed files with 1381 additions and 302 deletions
+5 -2
View File
@@ -20,8 +20,11 @@ export default defineEventHandler(async (event) => {
// 只处理 /api/ 路径
if (!pathname.startsWith("/api/")) return;
// OPTIONS 预检请求不需要鉴权CORS headers 由 nuxt.config routeRules 统一设置
if (method === "OPTIONS") return;
// OPTIONS 预检请求不需要鉴权;直接返回 204,避免没有匹配 API 路由时落到 404。
if (method === "OPTIONS") {
setResponseStatus(event, 204);
return "";
}
// 公开路由直接放行
if (isPublicApiRoute(pathname, method)) return;