diff --git a/DEPLOY.en.md b/DEPLOY.en.md index 8ac9927..42f3b48 100644 --- a/DEPLOY.en.md +++ b/DEPLOY.en.md @@ -66,6 +66,7 @@ Notes: - Serverless entry: `api/index.go` - Rewrites and cache headers: `vercel.json` - Build stage runs `npm ci --prefix webui && npm run build --prefix webui` automatically +- `vercel.json` routes `/admin/assets/*` and the `/admin` page to static output, while `/admin/*` APIs still go to `api/index` Minimum environment variables: diff --git a/DEPLOY.md b/DEPLOY.md index 75b3d90..78f92ea 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -66,6 +66,7 @@ docker-compose up -d --build - serverless 入口:`api/index.go` - 路由与缓存头:`vercel.json` - 构建阶段会自动执行 `npm ci --prefix webui && npm run build --prefix webui` +- `vercel.json` 已将 `/admin/assets/*` 与 `/admin` 页面走静态产物,`/admin/*` API 仍走 `api/index` 至少配置环境变量: diff --git a/vercel.json b/vercel.json index cef374e..db2bc6a 100644 --- a/vercel.json +++ b/vercel.json @@ -2,12 +2,59 @@ "version": 2, "buildCommand": "npm ci --prefix webui && npm run build --prefix webui", "outputDirectory": "static/admin", - "functions": { - "api/index.go": { - "includeFiles": "static/admin/**" - } - }, "rewrites": [ + { + "source": "/admin/login", + "destination": "/api/index" + }, + { + "source": "/admin/verify", + "destination": "/api/index" + }, + { + "source": "/admin/config", + "destination": "/api/index" + }, + { + "source": "/admin/keys(.*)", + "destination": "/api/index" + }, + { + "source": "/admin/accounts(.*)", + "destination": "/api/index" + }, + { + "source": "/admin/queue/status", + "destination": "/api/index" + }, + { + "source": "/admin/import", + "destination": "/api/index" + }, + { + "source": "/admin/test", + "destination": "/api/index" + }, + { + "source": "/admin/vercel/(.*)", + "destination": "/api/index" + }, + { + "source": "/admin/export", + "destination": "/api/index" + }, + { + "source": "/admin/assets/(.*)", + "destination": "/assets/$1" + }, + { + "source": "/admin", + "destination": "/index.html" + }, + { + "source": "/admin/(.*)", + "destination": "/index.html" + }, { "source": "/(.*)", "destination": "/api/index"