litianc
8e1bcf53bb
fix: extend RewriteUserID regex to match user_id containing account_uuid
...
The existing regex only matched the old format where account_uuid is
empty (account__session_). Real Claude Code clients and newer sub2api
generated user_ids use account_{uuid}_session_ which was silently
skipped, causing the original metadata.user_id to leak to upstream
when User-Agent is rewritten by an intermediate gateway.
Closes #766
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-04 23:13:17 +08:00
QTom
d869ac95fa
feat(identity): 指纹缓存 TTL 懒续期机制
...
- TTL 改为 7 天,配合 24 小时自动续期保持活跃账号永不过期
- 版本升级时采用合并语义,仅更新请求中实际存在的字段
- 添加产品名验证防止浏览器 UA 误判为更新版本
2026-03-02 01:12:41 +08:00
yangjianbo
584cfc3db2
chore(logging): 完成后端日志审计与结构化迁移
...
- 将高密度服务与处理器日志迁移到新日志系统(LegacyPrintf/结构化日志)
- 增加 stdlog bridge 与兼容测试,保留旧日志捕获能力
- 将 OpenAI 断流告警改为结构化 Warn 并改造对应测试为 sink 捕获
- 补齐后端相关文件 logger 引用并通过全量 go test
2026-02-12 19:01:09 +08:00
JIA-ss
ad90bb4645
fix(api): 修复 thinking 块被意外修改导致的 400 错误
...
问题描述:
使用扩展思考功能时,偶现以下错误:
"thinking or redacted_thinking blocks in the latest assistant message cannot be modified"
根因分析:
当代理服务修改请求体中的某些字段时(如 metadata.user_id、model),
使用 map[string]any 解析整个 JSON 后重新序列化,导致:
1. 字段顺序改变(Go map 序列化按字母排序)
2. 数字格式变化(如 1.0 → 1)
3. Unicode 转义变化
Claude API 对 thinking 块进行字节级验证,任何变化都会触发错误。
修复内容:
1. identity_service.go - RewriteUserID/RewriteUserIDWithMasking
使用 json.RawMessage 保留其他字段的原始字节
2. gateway_service.go - replaceModelInBody
使用 json.RawMessage 保留其他字段的原始字节
3. gateway_service.go - normalizeClaudeOAuthRequestBody
保留 messages 的原始字节,跳过包含 thinking 块的消息修改
4. gateway_service.go - isThinkingBlockSignatureError
添加 "cannot be modified" 错误检测,触发自动重试
5. antigravity_gateway_service.go - isSignatureRelatedError
添加 "cannot be modified" 错误检测
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-02-03 16:15:37 +08:00
cyhhao
c37fe91672
fix(oauth): update Claude CLI fingerprint headers
2026-01-29 02:52:26 +08:00
cyhhao
c8e2f614fa
Merge branch 'main' of github.com:Wei-Shaw/sub2api
2026-01-20 13:53:32 +08:00
shaw
ccfeaeb22d
feat: 新增会话ID伪装功能,优化日志系统
...
- 新增 session_id_masking_enabled 配置,启用后将在15分钟内固定
metadata.user_id 中的 session ID
- TLS fingerprint 模块日志从自定义 debugLog 迁移到 slog
- main.go 添加 slog 初始化,根据 gin mode 设置日志级别
- 前端创建/编辑账号模态框添加会话ID伪装开关
- 多语言支持(中英文)
2026-01-19 10:22:13 +08:00
cyhhao
46e5ac9672
fix(网关): 对齐 Claude OAuth 请求适配
2026-01-15 18:54:42 +08:00
Forest
f51ad2e126
refactor: 删除 ports 目录
2025-12-25 17:15:01 +08:00
Forest
836c4dda2b
refactor: 重命名 go module
2025-12-24 21:07:21 +08:00
shaw
6c469b42ed
feat: 新增支持codex转发
2025-12-22 22:58:31 +08:00
Forest
1e1f3c0c74
ci(backend): 添加 gofmt 配置
2025-12-20 16:19:40 +08:00
NepetaLemon
c6b3de1199
ci(backend): 添加 github actions ( #10 )
...
## 变更内容
### CI/CD
- 添加 GitHub Actions 工作流(test + golangci-lint)
- 添加 golangci-lint 配置,启用 errcheck/govet/staticcheck/unused/depguard
- 通过 depguard 强制 service 层不能直接导入 repository
### 错误处理修复
- 修复 CSV 写入、SSE 流式输出、随机数生成等未处理的错误
- GenerateRedeemCode() 现在返回 error
### 资源泄露修复
- 统一使用 defer func() { _ = xxx.Close() }() 模式
### 代码清理
- 移除未使用的常量
- 简化 nil map 检查
- 统一代码格式
2025-12-20 02:29:52 -05:00
Forest
7bbf621490
refactor(backend): 添加 service 缓存端口
2025-12-19 23:44:18 +08:00
shaw
642842c29e
First commit
2025-12-18 13:50:39 +08:00