1. 05 Apr, 2026 5 commits
  2. 31 Mar, 2026 1 commit
  3. 27 Mar, 2026 1 commit
  4. 19 Mar, 2026 1 commit
    • QTom's avatar
      feat(admin): 用户管理新增分组列、分组筛选与专属分组一键替换 · ba7d2aec
      QTom authored
      - 新增分组列:展示用户的专属/公开分组,支持 hover 查看详情
      - 新增分组筛选:下拉选择或模糊搜索分组名过滤用户
      - 专属分组替换:点击专属分组弹出操作菜单,选择目标分组后
        自动授予新分组权限、迁移绑定的 Key、移除旧分组权限
      - 后端新增 POST /admin/users/:id/replace-group 端点,事务内
        完成分组替换并失效认证缓存
      ba7d2aec
  5. 11 Mar, 2026 1 commit
  6. 09 Mar, 2026 1 commit
  7. 07 Mar, 2026 3 commits
  8. 04 Mar, 2026 1 commit
  9. 03 Mar, 2026 3 commits
    • shaw's avatar
      fix: correct migration 061 checksum and add missing BillingCache mock methods · 4a919545
      shaw authored
      - Fix fileChecksum for 061 migration: use TrimSpace hash (66207e7a) instead
        of raw sha256sum (97bdd9a3), matching the actual runtime computation
      - Add 222b4a09 as accepted DB checksum for 061 migration
      - Add missing GetAPIKeyRateLimit/SetAPIKeyRateLimit/UpdateAPIKeyRateLimitUsage/
        InvalidateAPIKeyRateLimit methods to mock BillingCache in test stubs
      - Fix NewBillingCacheService call in singleflight test (add apiKeyRepo param)
      4a919545
    • shaw's avatar
      fix: resolve CI lint errors and test compilation failures for rate limit feature · b8b5cec3
      shaw authored
      - Fix errcheck: properly handle rows.Close() error via named return + defer closure
      - Fix gofmt: auto-format billing_cache.go, api_key_service.go, billing_cache_service.go
      - Add missing rate limit interface methods to 4 test stubs (GetRateLimitData, IncrementRateLimitUsage, ResetRateLimitWindows)
      - Fix NewBillingCacheService calls missing the new apiKeyRepo parameter
      b8b5cec3
    • shaw's avatar
      feat: apikey支持5h/1d/7d速率控制 · a80ec5d8
      shaw authored
      a80ec5d8
  10. 28 Feb, 2026 2 commits
    • QTom's avatar
      feat(admin): 完整实现管理员修改用户 API Key 分组的功能 · 9a91815b
      QTom authored
      ## 核心功能
      - 添加 AdminUpdateAPIKeyGroupID 服务方法,支持绑定/解绑/保持不变三态语义
      - 实现 UserRepository.AddGroupToAllowedGroups 接口,自动同步专属分组权限
      - 添加 HTTP PUT /api-keys/:id handler 端点,支持管理员直接修改 API Key 分组
      
      ## 事务一致性
      - 使用 ent Tx 保证专属分组绑定时「添加权限」和「更新 Key」的原子性
      - Repository 方法支持 clientFromContext,兼容事务内调用
      - 事务失败时自动回滚,避免权限孤立
      
      ## 业务逻辑
      - 订阅类型分组阻断,需通过订阅管理流程
      - 非活跃分组拒绝绑定
      - 负 ID 和非法 ID 验证
      - 自动授权响应,告知管理员成功授权的分组
      
      ## 代码质量
      - 16 个单元测试覆盖所有业务路径和边界用例
      - 7 个 handler 集成测试覆盖 HTTP 层
      - GroupRepo stub 返回克隆副本,防止测试间数据泄漏
      - API 类型安全修复(PaginatedResponse<ApiKey>)
      - 前端 ref 回调类型对齐 Vue 规范
      
      ## 国际化支持
      - 中英文提示信息完整
      - 自动授权成功/失败提示
      9a91815b
    • yangjianbo's avatar
      feat(sync): full code sync from release · bb664d9b
      yangjianbo authored
      bb664d9b
  11. 22 Feb, 2026 1 commit
  12. 08 Feb, 2026 1 commit
    • bayma888's avatar
      feat(admin): add drag-and-drop group sort order · bac9e2bf
      bayma888 authored
      - Add `sort_order` field to groups table with migration
      - Add `PUT /api/v1/admin/groups/sort-order` API for batch update
      - Implement drag-and-drop UI using vue-draggable-plus
      - All queries now order groups by sort_order
      - Add i18n support (en/zh) for sort-related UI text
      - Update test stubs to satisfy new interface methods
      bac9e2bf
  13. 07 Feb, 2026 1 commit
    • yangjianbo's avatar
      fix(audit): 第二批审计修复 — P0 生产 Bug、安全加固、性能优化、缓存一致性、代码质量 · 2588fa6a
      yangjianbo authored
      
      
      基于 backend-code-audit 审计报告,修复剩余 P0/P1/P2 共 34 项问题:
      
      P0 生产 Bug:
      - 修复 time.Since(time.Now()) 计时逻辑错误 (P0-03)
      - generateRandomID 改用 crypto/rand 替代固定索引 (P0-04)
      - IncrementQuotaUsed 重写为 Ent 原子操作消除 TOCTOU 竞态 (P0-05)
      
      安全加固:
      - gateway/openai handler 错误响应替换为泛化消息,防止内部信息泄露 (P1-14)
      - usage_log_repo dateFormat 参数改用白名单映射,防止 SQL 注入 (P1-16)
      - 默认配置安全加固:sslmode=prefer、response_headers=true、mode=release (P1-18/19, P2-15)
      
      性能优化:
      - gateway handler 循环内 defer 替换为显式 releaseWait 闭包 (P1-02)
      - group_repo/promo_code_repo Count 前 Clone 查询避免状态污染 (P1-03)
      - usage_log_repo 四个查询添加 LIMIT 10000 防止 OOM (P1-07)
      - GetBatchUsageStats 添加时间范围参数,默认最近 30 天 (P1-10)
      - ip.go CIDR 预编译为包级变量 (P1-11)
      - BatchUpdateCredentials 重构为先验证后更新 (P1-13)
      
      缓存一致性:
      - billing_cache 添加 jitteredTTL 防止缓存雪崩 (P2-10)
      - DeductUserBalance/UpdateSubscriptionUsage 错误传播修复 (P2-12)
      - UserService.UpdateBalance 成功后异步失效 billingCache (P2-13)
      
      代码质量:
      - search 截断改为按 rune 处理,支持多字节字符 (P2-01)
      - TLS Handshake 改为 HandshakeContext 支持 context 取消 (P2-07)
      - CORS 预检添加 Access-Control-Max-Age: 86400 (P2-16)
      
      测试覆盖:
      - 新增 user_service_test.go(UpdateBalance 缓存失效 6 个用例)
      - 新增 batch_update_credentials_test.go(fail-fast + 类型验证 7 个用例)
      - 新增 response_transformer_test.go、ip_test.go、usage_log_repo_unit_test.go、search_truncate_test.go
      - 集成测试:IncrementQuotaUsed 并发测试、billing_cache 错误传播测试
      - config_test.go 补充 server.mode/sslmode 默认值断言
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      2588fa6a
  14. 03 Feb, 2026 1 commit
    • bayma888's avatar
      feat(api-key): add independent quota and expiration support · 6146be14
      bayma888 authored
      This feature allows API Keys to have their own quota limits and expiration
      times, independent of the user's balance.
      
      Backend:
      - Add quota, quota_used, expires_at fields to api_key schema
      - Implement IsExpired() and IsQuotaExhausted() checks in middleware
      - Add ResetQuota and ClearExpiration API endpoints
      - Integrate quota billing in gateway handlers (OpenAI, Anthropic, Gemini)
      - Include quota/expiration fields in auth cache for performance
      - Expiration check returns 403, quota exhausted returns 429
      
      Frontend:
      - Add quota and expiration inputs to key create/edit dialog
      - Add quick-select buttons for expiration (+7, +30, +90 days)
      - Add reset quota confirmation dialog
      - Add expires_at column to keys list
      - Add i18n translations for new features (en/zh)
      
      Migration:
      - Add 045_add_api_key_quota.sql for new columns
      6146be14
  15. 02 Feb, 2026 2 commits
  16. 31 Jan, 2026 2 commits
  17. 27 Jan, 2026 1 commit
    • song's avatar
      feat(group): 添加 MCP XML 注入开关 · 877c1725
      song authored
      - Group 新增 mcp_xml_inject 字段,控制 Antigravity 平台的 MCP XML 协议注入
      - 默认启用,可在分组设置中关闭
      - 修复 GetByKeyForAuth 遗漏查询 mcp_xml_inject 字段导致认证缓存值始终为 false 的问题
      877c1725
  18. 26 Jan, 2026 1 commit
    • shaw's avatar
      feat(auth): 实现 TOTP 双因素认证功能 · 1245f07a
      shaw authored
      新增功能:
      - 支持 Google Authenticator 等应用进行 TOTP 二次验证
      - 用户可在个人设置中启用/禁用 2FA
      - 登录时支持 TOTP 验证流程
      - 管理后台可全局开关 TOTP 功能
      
      安全增强:
      - TOTP 密钥使用 AES-256-GCM 加密存储
      - 添加 TOTP_ENCRYPTION_KEY 配置项,必须手动配置才能启用功能
      - 防止服务重启导致加密密钥变更使用户无法登录
      - 验证失败次数限制,防止暴力破解
      
      配置说明:
      - Docker 部署:在 .env 中设置 TOTP_ENCRYPTION_KEY
      - 非 Docker 部署:在 config.yaml 中设置 totp.encryption_key
      - 生成密钥命令:openssl rand -hex 32
      1245f07a
  19. 23 Jan, 2026 1 commit
  20. 16 Jan, 2026 1 commit
    • longgexx's avatar
      feat(group): 添加分组级别模型路由配置功能 · 19865b86
      longgexx authored
        支持为分组配置模型路由规则,可以指定特定模型模式优先使用的账号列表。
      
        - 新增 model_routing 字段存储路由配置(JSONB格式,支持通配符匹配)
      
        - 新增 model_routing_enabled 字段控制是否启用路由
      
        - 更新后端 handler/service/repository 支持路由配置的增删改查
      
        - 更新前端 GroupsView 添加路由配置界面
      
        - 添加数据库迁移脚本 040/041
      19865b86
  21. 11 Jan, 2026 1 commit
  22. 10 Jan, 2026 2 commits
  23. 09 Jan, 2026 2 commits
    • Edric.Li's avatar
      feat(api-key): 添加 IP 白名单/黑名单限制功能 (#221) · 0a4641c2
      Edric.Li authored
      * feat(api-key): add IP whitelist/blacklist restriction and usage log IP tracking
      
      - 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
      
      * fix: update API contract tests for ip_whitelist/ip_blacklist fields
      
      Add ip_whitelist and ip_blacklist fields to expected JSON responses
      in API contract tests to match the new API key schema.
      0a4641c2
    • 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
  24. 08 Jan, 2026 1 commit
    • Edric Li's avatar
      feat(groups): add Claude Code client restriction and session isolation · a4210588
      Edric Li authored
      - Add claude_code_only field to restrict groups to Claude Code clients only
      - Add fallback_group_id for non-Claude Code requests to use alternate group
      - Implement ClaudeCodeValidator for User-Agent detection
      - Add group-level session binding isolation (groupID in Redis key)
      - Prevent cross-group sticky session pollution
      - Update frontend with Claude Code restriction controls
      a4210588
  25. 05 Jan, 2026 1 commit
    • song's avatar
      feat: 图片生成计费功能 · d4c2b723
      song authored
      - 新增 Group 图片价格配置(image_price_1k/2k/4k)
      - BillingService 新增 CalculateImageCost 方法
      - AntigravityGatewayService 支持识别图片生成模型并按次计费
      - UsageLog 新增 image_count 和 image_size 字段
      - 前端分组管理支持配置图片价格(antigravity 和 gemini 平台)
      - 图片计费复用通用计费能力(余额检查、扣费、倍率、订阅限额)
      d4c2b723
  26. 04 Jan, 2026 1 commit
    • 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
  27. 03 Jan, 2026 1 commit
    • ianshaw's avatar
      chore: 更新依赖、配置和代码生成 · 112a2d08
      ianshaw authored
      主要更新:
      - 更新 go.mod/go.sum 依赖
      - 重新生成 Ent ORM 代码
      - 更新 Wire 依赖注入配置
      - 添加 docker-compose.override.yml 到 .gitignore
      - 更新 README 文档(Simple Mode 说明和已知问题)
      - 清理调试日志
      - 其他代码优化和格式修复
      112a2d08