feat: centralize DeepSeek SSE parsing, improve account identifier resolution, and simplify CORS configuration.

This commit is contained in:
CJACK
2026-02-17 03:45:55 +08:00
parent 2cde0a1d84
commit 23d5ac7fa2
12 changed files with 263 additions and 75 deletions

View File

@@ -106,7 +106,7 @@
### 13. CORS 配置矛盾
- **位置**: `internal/server/router.go`
- **问题**: 同时设置 `Access-Control-Allow-Origin: *` 和 `Access-Control-Allow-Credentials: true` 是无效的(浏览器安全规范)。
- **建议**: 动态反射 Origin 或移除 Credentials 允许
- **建议**: 若采用宽松模式,保持 `Access-Control-Allow-Origin: *`,并移除 `Access-Control-Allow-Credentials`
---
@@ -116,4 +116,4 @@
1. **Phase 1 (Fix Critical) ✅ 已完成:** ~~修复 `Save()` 锁问题、WASM 重复创建、Admin 默认密码警告、Graceful Shutdown。删除无用大文件。~~ 同时修复了 `itoa` 低效实现。
2. **Phase 2 (Refactor) ✅ 已完成:** ~~统一 API Key/Account 的索引机制,重构 SSE 解析逻辑 (DRY),优化 `testAllAccounts` 并发。~~ 同时完成了重复工具函数的统一清理(`writeJSON`/`toBool`/`intFrom` → `internal/util`)。
3. **Phase 3 (Cleanup) ✅ 已完成:** ~~优化 CORS改进 Token 估算等微小性能点。~~ CORS 改为动态反射 OriginToken 估算区分 ASCII/非 ASCII 字符。
3. **Phase 3 (Cleanup) ✅ 已完成:** ~~优化 CORS改进 Token 估算等微小性能点。~~ CORS 采用宽松模式(`Access-Control-Allow-Origin: *`,不启用 CredentialsToken 估算区分 ASCII/非 ASCII 字符。