"backend/internal/pkg/vscode:/vscode.git/clone" did not exist on "4280aca82c59fb82377e763e4ea07dad678833f8"
  1. 09 Jan, 2026 7 commits
    • Edric Li's avatar
      feat(api-key): add IP whitelist/blacklist restriction and usage log IP tracking · 90798f14
      Edric Li authored
      - Add IP restriction feature for API keys (whitelist/blacklist with CIDR support)
      - Add IP address logging to usage logs (admin-only visibility)
      - Remove billing_type column from usage logs UI (redundant)
      - Use generic "Access denied" error message for security
      
      Backend:
      - New ip package with IP/CIDR validation and matching utilities
      - Database migrations for ip_whitelist, ip_blacklist (api_keys) and ip_address (usage_logs)
      - Middleware IP restriction check after API key validation
      - Input validation for IP/CIDR patterns on create/update
      
      Frontend:
      - API key form with enable toggle for IP restriction
      - Shield icon indicator in table for keys with IP restriction
      - Removed billing_type filter and column from usage views
      90798f14
    • IanShaw027's avatar
      fix(admin): 代码审查修复 - 输入验证和测试完善 · 7c3d5cad
      IanShaw027 authored
      根据 Codex 代码审查报告,修复所有 P0 和 P1 优先级问题。
      
      ## P0 紧急修复
      
      ### 1. 修复集成测试编译错误
      - 更新 group_repo_integration_test.go 中所有 ListWithFilters 调用
      - 添加缺失的 search 参数(传入空字符串)
      - 修复 4 处旧签名调用,避免 CI 编译失败
      
      ### 2. 添加统一的 search 参数输入验证
      为所有 admin handler 添加一致的输入验证逻辑:
      - group_handler.go: 添加 TrimSpace + 长度限制
      - proxy_handler.go: 添加 TrimSpace + 长度限制
      - redeem_handler.go: 添加 TrimSpace + 长度限制
      - user_handler.go: 添加 TrimSpace + 长度限制
      
      验证规则:
      - TrimSpace() 去除首尾空格
      - 最大长度 100 字符(防止 DoS 攻击)
      - 超长输入自动截断
      
      ## P1 改进
      
      ### 3. 补充 search 功能的单元测试
      新增 admin_service_group_test.go 中的测试:
      - TestAdminService_ListGroups_WithSearch
        - search 参数正常传递到 repository 层
        - search 为空字符串时的行为
        - search 与其他过滤条件组合使用
      
      新增 admin_service_search_test.go 文件:
      - 为其他 admin API 添加 search 测试覆盖
      - 统一的测试模式和断言
      
      ### 4. 补充 search 功能的集成测试
      新增 group_repo_integration_test.go 测试场景:
      - TestListWithFilters_Search
        - 搜索 name 字段匹配
        - 搜索 description 字段匹配
        - 搜索不存在内容(返回空)
        - 大小写不敏感测试
        - 特殊字符转义测试(%、_)
        - 与其他过滤条件组合
      
      ## 测试结果
      
      -  编译检查通过
      -  单元测试全部通过 (3/3)
      -  集成测试编译通过
      -  所有 service 测试通过
      
      ## 影响范围
      
      修改文件: 8 个
      代码变更: +234 行 / -8 行
      
      ## 相关 Issue
      
      解决代码审查中的安全性和稳定性问题:
      - 防止 DoS 攻击(超长搜索字符串)
      - 修复测试编译错误(CI 阻塞问题)
      - 提升测试覆盖率
      7c3d5cad
    • shaw's avatar
      f060db0b
    • IanShaw027's avatar
      feat(admin): 添加账号批量调度开关功能 · 5e936fbf
      IanShaw027 authored
      - 后端:支持批量更新账号的 schedulable 字段
        - 在 BulkUpdateAccountsRequest 中添加 schedulable 参数
        - 在 AccountBulkUpdate 中添加 schedulable 字段支持
        - 更新 repository 层批量更新 SQL 逻辑
      - 前端:在账号管理页面添加批量调度控制
        - 新增"批量启用调度"和"批量停止调度"按钮
        - 添加 handleBulkToggleSchedulable 处理函数
        - 显示具体的成功提示信息(包含操作账号数量)
      - 国际化:添加批量调度相关中英文翻译
      - 优化:添加 search 参数标准化和验证(account_handler)
      5e936fbf
    • IanShaw027's avatar
      fix(admin): 修复表格批量操作和搜索功能问题 · 38202322
      IanShaw027 authored
      1. 恢复账号管理批量操作栏缺失的功能按钮
         - 添加"本页全选"按钮支持批量选择当前页所有账号
         - 添加"清除已选"按钮快速清空已选账号列表
         - 在重构拆分组件时遗漏,现已恢复
      
      2. 修复分组管理搜索功能仅搜索当前页的问题
         - 前端:移除本地过滤逻辑,改用后端搜索
         - 后端:添加 search 参数支持,搜索名称和描述字段
         - 支持不区分大小写的模糊匹配
         - 统一所有管理页面的搜索体验
      38202322
    • admin's avatar
      refactor(auth): 将 Linux DO OAuth 配置迁移到系统设置 · d1c2a61d
      admin authored
      - 将 LinuxDo Connect 配置从环境变量迁移到数据库持久化
      - 在管理后台系统设置中添加 LinuxDo OAuth 配置项
      - 简化部署流程,无需修改 docker-compose.override.yml
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      d1c2a61d
    • admin's avatar
      feat(auth): 添加 Linux DO Connect OAuth 登录支持 · 152d0cde
      admin authored
      - 新增 Linux DO OAuth 配置项和环境变量支持
      - 实现 OAuth 授权流程和回调处理
      - 前端添加 Linux DO 登录按钮和回调页面
      - 支持通过 Linux DO 账号注册/登录
      - 添加相关国际化文本
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      152d0cde
  2. 08 Jan, 2026 5 commits
  3. 07 Jan, 2026 2 commits
  4. 06 Jan, 2026 3 commits
    • shaw's avatar
      feat(admin/usage): 优化管理员用量页面功能和体验 · 015974a2
      shaw authored
      后端改进:
      - 新增 GetStatsWithFilters 方法支持完整筛选条件
      - Stats 端点支持 account_id, group_id, model, stream, billing_type 参数
      - 统一使用 filters 结构体,移除冗余的分支逻辑
      
      前端改进:
      - 统计卡片添加"所选范围内"文字提示
      - 优化总消费显示格式,清晰展示实际费用和标准计费
      - Token 和费用列添加问号图标 tooltip 显示详细信息
      - API Key 搜索框体验优化:点击即显示下拉选项
      - 选择用户后自动加载该用户的所有 API Key
      015974a2
    • yangjianbo's avatar
      fix(并发): 修复 wrapReleaseOnDone goroutine 泄露问题 · 823497a2
      yangjianbo authored
      问题描述:
      - wrapReleaseOnDone 函数创建的 goroutine 会持续等待 ctx.Done()
      - 即使 release() 已被调用,goroutine 仍不会退出
      - 高并发场景下(1000 req/s)会产生 3000+ 个泄露 goroutine
      
      修复方案:
      - 添加 quit channel 作为退出信号
      - 正常释放时 close(quit) 通知 goroutine 立即退出
      - 使用 select 监听 ctx.Done() 和 quit 两个信号
      - 确保 goroutine 在正常流程中及时退出
      
      测试覆盖:
      - 新增 5 个单元测试验证修复效果
      - 验证 goroutine 不泄露
      - 验证并发安全性和多次调用保护
      - 性能影响:471.9 ns/op, 208 B/op
      
      影响范围:
      - gateway_handler.go: 每请求调用 2-4 次
      - openai_gateway_handler.go: 每请求调用 2-3 次
      - 修复后 goroutine 泄露数量从 3/req 降至 0
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Sonnet 4.5 <noreply@anthropic.com>
      823497a2
    • Yuhao Jiang's avatar
      fix: 修复跨时区用户日期范围查询不准确的问题 · f5603b07
      Yuhao Jiang authored
      问题:当用户时区与服务器时区不同时,日期范围查询使用服务器时区解析,
      导致用户看到的数据与预期不符。
      
      修复方案:
      - 前端:所有 GET 请求自动携带用户时区参数
      - 后端:新增时区辅助函数,所有日期解析和默认日期范围计算都使用用户时区
      - 当用户时区为空或无效时,自动回退到服务器时区
      
      🤖 Generated with [Claude Code](https://claude.ai/code
      
      )
      Co-Authored-By: default avatarClaude <noreply@anthropic.com>
      f5603b07
  5. 05 Jan, 2026 7 commits
    • song's avatar
      fix: Antigravity 账户刷新 token 500 错误 · 6fa704d6
      song authored
      AccountHandler.Refresh 方法缺少对 Antigravity 平台的处理分支,
      导致刷新时错误地走进 Claude 刷新逻辑。
      6fa704d6
    • song's avatar
      fix: 图片计费代码审查问题修复 · 5b1907fe
      song authored
      - isImageGenerationModel 改为精确匹配/前缀匹配,避免误匹配
      - 新增 normalizePrice 函数,支持负数清除价格配置
      - 更新注释说明 Gemini API 每次请求只生成一张图片
      - 添加测试用例验证不会误匹配自定义模型名
      5b1907fe
    • song's avatar
      feat: 图片生成计费功能 · d4c2b723
      song authored
      - 新增 Group 图片价格配置(image_price_1k/2k/4k)
      - BillingService 新增 CalculateImageCost 方法
      - AntigravityGatewayService 支持识别图片生成模型并按次计费
      - UsageLog 新增 image_count 和 image_size 字段
      - 前端分组管理支持配置图片价格(antigravity 和 gemini 平台)
      - 图片计费复用通用计费能力(余额检查、扣费、倍率、订阅限额)
      d4c2b723
    • LLLLLLiulei's avatar
      feat: add account notes field · 94750fb6
      LLLLLLiulei authored
      94750fb6
    • yangjianbo's avatar
      feat(安全): 添加安全开关并完善测试流程 · 794a9f96
      yangjianbo authored
      实现安全开关默认关闭与响应头透传逻辑
      - URL 校验与响应头过滤支持开关并覆盖流式路径
      - 非流式 Content-Type 透传/默认值按配置生效
      - 接入 go test、golangci-lint 与前端 lint/typecheck
      - 补充相关测试与配置/文档说明
      794a9f96
    • Jiahao Luo's avatar
      feat(crs-sync): improve error messages and add private IP allowlist support · 204190f8
      Jiahao Luo authored
      ## Changes
      
      ### 1. Enhanced Error Messages
      - Modified CRS sync error handling to show detailed error messages
      - Changed from generic "internal error" to "CRS sync failed: <details>"
      - Helps diagnose connection issues with private CRS deployments
      
      ### 2. Security Configuration
      - Added SECURITY_URL_ALLOWLIST_ALLOW_PRIVATE_HOSTS environment variable
      - Allows administrators to enable/disable private IP access for CRS sync
      - Production default: false (secure)
      - Test environment default: true (convenient for internal testing)
      
      ### 3. Flexible Configuration Support
      - Added config.yaml mount support in both production and test environments
      - Supports dual configuration methods:
        * config.yaml for detailed/complex configurations
        * Environment variables for quick overrides
      - Priority: ENV vars > config.yaml > defaults
      
      ## Use Case
      Enables CRS sync from internal deployments where CRS resolves to private IPs
      (e.g., 10.x.x.x, 192.168.x.x) while maintaining security by default.
      
      ## Files Modified
      - backend/internal/handler/admin/account_handler.go
      - deploy/docker-compose.yml
      - deploy/docker-compose-test.yml
      204190f8
    • Yuhao Jiang's avatar
      fix(后端): 修复 Turnstile Secret Key 留空保留当前值不生效的问题 · 411ebe4d
      Yuhao Jiang authored
      前端显示"密钥已配置,留空以保留当前值",但后端验证逻辑直接
      要求该字段非空,导致修改其他设置时报错。
      
      修复方案:
      - 当 TurnstileSecretKey 为空时,检查 previousSettings 是否有已保存的值
      - 如果有,使用已保存的值而非返回错误
      - 同时移除重复获取 currentSettings 的代码,直接复用 previousSettings
      
      🤖 Generated with [Claude Code](https://claude.ai/code
      
      )
      Co-Authored-By: default avatarClaude <noreply@anthropic.com>
      411ebe4d
  6. 04 Jan, 2026 10 commits
    • IanShaw027's avatar
      fix: 修复代码审查报告中的4个关键问题 · f60f943d
      IanShaw027 authored
      1. 资源管理冗余(ForwardGemini双重Close)
         - 错误分支读取body后立即关闭原始body,用内存副本重新包装
         - defer添加nil guard,避免重复关闭
         - fallback成功时显式关闭旧body,确保连接释放
      
      2. Schema校验丢失(cleanJSONSchema移除字段无感知)
         - 新增schemaCleaningWarningsEnabled()支持环境变量控制
         - 实现warnSchemaKeyRemovedOnce()在非release模式下告警
         - 移除关键验证字段时输出warning,包含key和path
      
      3. UI响应式风险(UsersView操作菜单硬编码定位)
         - 菜单改为先粗定位、渲染后测量、再clamp到视口内
         - 添加max-height + overflow-auto,超出时可滚动
         - 增强交互:点击其它位置/滚动/resize自动关闭或重新定位
      
      4. 身份补丁干扰(TransformClaudeToGemini默认注入)
         - 新增TransformOptions + TransformClaudeToGeminiWithOptions
         - 系统设置新增enable_identity_patch、identity_patch_prompt
         - 完整打通handler/dto/service/frontend配置链路
         - 默认保持启用,向后兼容现有行为
      
      测试:
      - 后端单测全量通过:go test ./...
      - 前端类型检查通过:npm run typecheck
      f60f943d
    • yangjianbo's avatar
      fix(后端): 修复 lint 失败并清理无用代码 · 5dd8b880
      yangjianbo authored
      修正测试中的 APIKey 名称引用
      移除不可达返回与未使用函数
      统一 gofmt 格式并处理 Close 错误
      5dd8b880
    • IanShaw027's avatar
      fix(backend): 修复 P0/P1 严重安全和稳定性问题 · 7122b3b3
      IanShaw027 authored
      P0 严重问题修复:
      - 优化重试机制:降至 5 次 + 指数退避 + 10s 上限,防止请求堆积
      - 修复 SSE 错误格式:符合 Anthropic API 规范,添加错误类型标准化
      
      P1 重要问题修复:
      - 防止 DOS 攻击:使用 io.LimitReader 限制请求体 10MB,流式解析
      - 修复计费数据丢失:改为同步计费,使用独立 context 防止中断
      
      技术细节:
      - 新增 retryBackoffDelay() 和 sleepWithContext() 支持 context 取消
      - 新增 normalizeAnthropicErrorType() 和 sanitizePublicErrorMessage()
      - 新增 parseGatewayRequestStream() 实现流式解析
      - 新增 recordUsageSync() 确保计费数据持久化
      
      影响:
      - 极端场景重试时间从 30s 降至 ≤10s
      - 防止高并发 OOM 攻击
      - 消除计费数据丢失风险
      - 提升客户端兼容性
      7122b3b3
    • IanShaw027's avatar
    • yangjianbo's avatar
      fix(流式): 提升SSE稳定性并统一超时配置 · 73ffb585
      yangjianbo authored
      - 扩展SSE行长与间隔超时处理,补充keepalive
      
      - 写入失败与超长行时发送错误事件,修复并发释放
      
      - 同步默认配置与示例配置,更新Caddy超时/压缩规则
      
      - 新增OpenAI流式超时与超长行测试
      
      测试: go test ./...
      73ffb585
    • IanShaw027's avatar
      fix(lint): 修复所有 Go 命名规范问题 · a4953785
      IanShaw027 authored
      - 全局替换 ApiKey → APIKey(类型、字段、方法、变量)
      - 修复所有 initialism 命名(API, SMTP, HTML, URL 等)
      - 添加所有缺失的包注释
      - 修复导出符号的注释格式
      
      主要修改:
      - ApiKey → APIKey(所有出现的地方)
      - ApiKeyID → APIKeyID
      - ApiKeyIDs → APIKeyIDs
      - TestSmtpConnection → TestSMTPConnection
      - HtmlURL → HTMLURL
      - 添加 20+ 个包注释
      - 修复 10+ 个导出符号注释格式
      
      验证结果:
      - ✓ golangci-lint: 0 issues
      - ✓ 单元测试: 通过
      - ✓ 集成测试: 通过
      a4953785
    • IanShaw027's avatar
      refactor(settings): 规范化缩写词命名并优化前端帮助界面 · 2632a710
      IanShaw027 authored
      - 后端:将 Smtp/Api/Doc 字段改为 SMTP/API/Doc(遵循 Go 命名规范)
      - 前端:添加 Gemini 帮助按钮,简化配额说明展示
      2632a710
    • song's avatar
      fix: 转发失败日志添加账户ID信息 · 3932bf03
      song authored
      3932bf03
    • IanShaw027's avatar
      feat(gemini): 完善 Gemini OAuth 配额系统和用量显示 · a185ad11
      IanShaw027 authored
      主要改动:
      - 后端:重构 Gemini 配额服务,支持多层级配额策略(GCP Standard/Free, Google One, AI Studio, Code Assist)
      - 后端:优化 OAuth 服务,增强 tier_id 识别和存储逻辑
      - 后端:改进用量统计服务,支持不同平台的配额查询
      - 后端:优化限流服务,增加临时解除调度状态管理
      - 前端:统一四种授权方式的用量显示格式和徽标样式
      - 前端:增强账户配额信息展示,支持多种配额类型
      - 前端:改进创建和重新授权模态框的用户体验
      - 国际化:完善中英文配额相关文案
      - 移除 CHANGELOG.md 文件
      
      测试:所有单元测试通过
      a185ad11
    • shaw's avatar
      feat(proxy): 统一代理配置并支持 SOCKS5H 协议 · 70e9329e
      shaw authored
      - 新增 proxyutil 包,统一 HTTP/HTTPS/SOCKS5/SOCKS5H 代理配置逻辑
      - SOCKS5H 支持服务端 DNS 解析,避免本地 DNS 泄露
      - 移除 ProxyStrict 宽松模式,代理失败直接返回错误不回退直连
      - 前端代理管理页面支持 SOCKS5H 协议的添加/编辑/批量导入
      - 补充 IPv6 地址和特殊字符密码的边界测试
      70e9329e
  7. 03 Jan, 2026 6 commits
    • ianshaw's avatar
      fix(lint): 修复 golangci-lint 检查问题 · 519b0b24
      ianshaw authored
      - 格式化代码 (gofmt)
      - 修复 rows.Close() 返回值未检查 (errcheck)
      - 删除未使用的 usage_clamp.go 文件 (unused)
      - 删除临时测试目录
      519b0b24
    • ianshaw's avatar
      chore: 更新依赖、配置和代码生成 · 112a2d08
      ianshaw authored
      主要更新:
      - 更新 go.mod/go.sum 依赖
      - 重新生成 Ent ORM 代码
      - 更新 Wire 依赖注入配置
      - 添加 docker-compose.override.yml 到 .gitignore
      - 更新 README 文档(Simple Mode 说明和已知问题)
      - 清理调试日志
      - 其他代码优化和格式修复
      112a2d08
    • ianshaw's avatar
      feat(admin): 添加临时不可调度功能 · 09da6904
      ianshaw authored
      当账号触发特定错误码和关键词匹配时,自动临时禁用调度:
      
      后端:
      - 新增 TempUnschedCache Redis 缓存层
      - RateLimitService 支持规则匹配和状态管理
      - 添加 GET/DELETE /accounts/:id/temp-unschedulable API
      - 数据库迁移添加 temp_unschedulable_until/reason 字段
      
      前端:
      - 账号状态指示器显示临时不可调度状态
      - 新增 TempUnschedStatusModal 详情弹窗
      - 创建/编辑账号时支持配置规则和预设模板
      - 完整的中英文国际化支持
      09da6904
    • ianshaw's avatar
      feat(gemini): 优化 OAuth 和配额展示 · 26106eb0
      ianshaw authored
      主要改进:
      - 修复 google_one OAuth scopes 配置问题
      - 添加 Gemini 账号配额展示组件
      - 优化 Code Assist 类型检测逻辑
      - 添加 OAuth 测试用例
      26106eb0
    • ianshaw's avatar
      feat(antigravity): 增强网关功能和 thinking 块处理 · 26438f72
      ianshaw authored
      主要改进:
      - 优化 thinking blocks 过滤策略,支持 Auto 模式降级
      - 将无效 thinking block 内容转为普通 text
      - 保留单个空白 text block,不过滤
      - 重构配额刷新机制,统一与 Claude 一致
      - 支持 cachedContentTokenCount 映射到 cache_read_input_tokens
      - Haiku 模型映射到 Sonnet
      - 添加 /antigravity/v1/models 端点支持
      - countTokens 端点直接返回空值
      26438f72
    • ianshaw's avatar
      refactor: 移除 Ops 监控模块 · df1ef3de
      ianshaw authored
      移除未完成的运维监控功能,简化系统架构:
      - 删除 ops_handler, ops_service, ops_repo 等后端代码
      - 删除 ops 相关数据库迁移文件
      - 删除前端 OpsDashboard 页面和 API
      df1ef3de