feat: 优化web

This commit is contained in:
2026-04-23 18:58:13 +08:00
commit 544a2f3428
160 changed files with 27327 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
# CORS / HTTPS 清单(开发 → 生产)
## 开发(当前)
- Go 已加 [`internal/server/cors.go`](../internal/server/cors.go):仅 **Origin 为 `http://localhost:*` / `http://127.0.0.1:*` / `http://[::1]:*`** 时反射 `Access-Control-Allow-Origin` 并允许 **Credentials**
- 前端 `web/.env.local` 设置 `NEXT_PUBLIC_API_ORIGIN=http://127.0.0.1:8000`(与 Go 监听一致)。
- OAuth `redirect_uri` 须与 Go /oauth 客户端种子登记一致(如 `http://localhost:3000/oauth/callback`)。
## 生产
- **同源**Next 与 Go 同站点 / 反代为同一 Origin 时,浏览器 **简单请求无 CORS**;请关闭或收紧对公网暴露的 CORS。
- **HTTPS**Cookie `Secure``SameSite` 与 OAuth 重定向须用 **HTTPS**;参阅 `configs` 里 Session 配置。
- 多环境 `redirect_uri`:在 OAuth 客户端表中登记各环境回调 URL。