1. 21 Apr, 2026 2 commits
  2. 20 Apr, 2026 6 commits
  3. 14 Apr, 2026 4 commits
    • erio's avatar
      feat(notify): convert email lists to NotifyEmailEntry struct with toggle support · 915b7a4a
      erio authored
      - Change balance_notify_extra_emails and account_quota_notify_emails
        from []string to []NotifyEmailEntry{email, disabled, verified}
      - Add per-email enable/disable toggle for both user and admin notifications
      - Add PUT /user/notify-email/toggle API endpoint
      - Fix critical bug: API key auth cache snapshot missing balance notify
        fields (Email, Username, BalanceNotifyEnabled, etc.), causing
        notifications to never fire on cached request paths
      - Bump cache snapshot version 3→4 to invalidate stale entries
      - Add SQL migration 104 to convert old format data
      - Backward compatible: parseNotifyEmails auto-detects old/new format
      - User balance notify: max 3 emails (primary + 2 extra)
      - Admin quota notify: unlimited emails, each with toggle
      915b7a4a
    • erio's avatar
      fix: address audit findings for websearch and balance notification · 9e33d0c4
      erio authored
      - Fix GetByKeyForAuth not selecting balance notify fields (notifications
        never triggered in gateway path)
      - Fix provider-level ProxyURL never resolved: inject ProxyRepository into
        SettingService, resolve proxy URLs when building Manager
      - Fix admin manual balance adjustment not updating total_recharged
      - Add threshold_type input validation (reject invalid values)
      - Fix user threshold_type inheritance: custom threshold defaults to "fixed"
        instead of inheriting global type (prevents $5 being treated as 5%)
      - Add try-catch for clipboard.writeText (fails on non-HTTPS)
      - Add SetTotalRecharged to user Update for admin balance operations
      9e33d0c4
    • erio's avatar
      feat(notify): add percentage threshold type for balance low notification · f694afbb
      erio authored
      - Add threshold_type field (fixed/percentage) to system and user settings
      - Add total_recharged field to users table, auto-incremented on balance credit
      - Percentage mode: effective threshold = total_recharged × percentage / 100
      - User-level threshold_type inherits from system default when not set
      - Update admin settings UI with radio selector (fixed amount / percentage)
      - Migration: 102_add_balance_notify_threshold_type.sql
      f694afbb
    • erio's avatar
      feat(notify): add balance low & account quota notification system · b32d1a2c
      erio authored
      - User balance low notification: email alert when balance drops below
        configurable threshold (user email + verified extra emails)
      - Account quota notification: broadcast email to admin-configured
        recipients when daily/weekly/total quota usage exceeds alert threshold
      - Admin settings: global enable/disable, default threshold, quota
        notification email list (Email Settings tab)
      - User profile: enable/disable, custom threshold, add/remove extra
        notification emails with verification code flow
      - Account quota: per-dimension alert toggle and threshold in quota
        control card
      - Trigger logic: first-crossing only (old >= threshold && new < threshold
        for balance; old < threshold && new >= threshold for quota), naturally
        prevents duplicate notifications without Redis dedup
      b32d1a2c
  4. 09 Apr, 2026 2 commits
  5. 05 Apr, 2026 1 commit
  6. 19 Mar, 2026 1 commit
    • QTom's avatar
      feat(admin): 用户管理新增分组列、分组筛选与专属分组一键替换 · ba7d2aec
      QTom authored
      - 新增分组列:展示用户的专属/公开分组,支持 hover 查看详情
      - 新增分组筛选:下拉选择或模糊搜索分组名过滤用户
      - 专属分组替换:点击专属分组弹出操作菜单,选择目标分组后
        自动授予新分组权限、迁移绑定的 Key、移除旧分组权限
      - 后端新增 POST /admin/users/:id/replace-group 端点,事务内
        完成分组替换并失效认证缓存
      ba7d2aec
  7. 04 Mar, 2026 2 commits
  8. 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
  9. 11 Feb, 2026 1 commit
    • kyx236's avatar
      feat(admin): Add email search and rate limit filtering for accounts and redeem codes · 04a1a7c2
      kyx236 authored
      - Add used_by_email column to redeem code export CSV for better user identification
      - Implement rate_limited status filter in account listing with RateLimitResetAt check
      - Extend redeem code search to include user email in addition to code matching
      - Add API key search capability to user listing filters
      - Display user email in redeem code table used_by column for improved visibility
      - Update search placeholders in UI to reflect expanded search capabilities (email, username, notes, API key)
      - Improve Chinese and English localization strings for search hints
      04a1a7c2
  10. 02 Feb, 2026 2 commits
    • song's avatar
      merge upstream main · 0170d19f
      song authored
      0170d19f
    • 小北's avatar
      feat: 支持在用户搜索中使用备注字段 · 426ce616
      小北 authored
      - 在用户仓库的搜索过滤器中添加备注字段
      - 管理员现在可以通过备注/标记搜索用户
      - 使用不区分大小写的搜索(ContainsFold)
      
      Changes:
      - backend/internal/repository/user_repo.go: 添加 NotesContainsFold 到搜索条件
      426ce616
  11. 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
  12. 05 Jan, 2026 1 commit
    • longgexx's avatar
      fix(billing): 修复计费漏洞 · d6f8ac02
      longgexx authored
          - 允许余额透支策略
      
         ## 问题
         - 扣费失败时只记录日志,不阻止请求完成
         - 用户可以用极少余额无限次免费使用服务
         - 数据库层使用 BalanceGTE 条件防止余额变负,导致余额不足时扣费失败
      
         ## 修复
         - 移除 DeductBalance 方法中的 BalanceGTE 条件,允许余额变为负数
         - 修改错误返回:用户不存在时返回 ErrUserNotFound
         - 实现透支策略:余额不足时允许本次请求完成,余额变负后阻止后续请求
      
         ## 测试
         - 更新 TestDeductBalance_InsufficientFunds 测试,验证透支功能
         - 更新 TestDeductBalance_NotFound 测试,验证正确的错误类型
         - 新增 TestDeductBalance_AllowsOverdraft 测试,专门测试透支场景
         - 所有测试通过 
      d6f8ac02
  13. 03 Jan, 2026 2 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
  14. 01 Jan, 2026 1 commit
    • Edric Li's avatar
      refactor: migrate wechat to user attributes and enhance users list · 404bf0f8
      Edric Li authored
      Migrate the hardcoded wechat field to the new extensible user
      attributes system and improve the users management UI.
      
      Migration:
      - Add migration 019 to move wechat data to user_attribute_values
      - Remove wechat field from User entity, DTOs, and API contracts
      - Clean up wechat-related code from backend and frontend
      
      UsersView enhancements:
      - Add text labels to action buttons (Filter Settings, Column Settings,
        Attributes Config) for better UX
      - Change status column to show colored dot + Chinese text instead of
        English text
      - Add dynamic attribute columns support with batch loading
      - Add column visibility settings with localStorage persistence
      - Add filter settings modal for search and filter preferences
      - Update i18n translations
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      404bf0f8
  15. 31 Dec, 2025 2 commits
    • yangjianbo's avatar
      fix(lint): 修复 golangci-lint 报告的代码问题 · 682f546c
      yangjianbo authored
      - errcheck: 修复类型断言未检查返回值的问题
        - pool.go: 添加 sync.Map 类型断言安全检查
        - req_client_pool.go: 添加 sync.Map 类型断言安全检查
        - concurrency_cache_benchmark_test.go: 显式忽略断言返回值
        - gateway_service.go: 显式忽略 WriteString 返回值
      
      - gofmt: 修复代码格式问题
        - redis.go: 注释对齐
        - api_key_repo.go: 结构体字段对齐
        - concurrency_cache.go: 字段对齐
        - http_upstream.go: 注释对齐
      
      - unused: 删除未使用的代码
        - user_repo.go: 删除未使用的 sql 字段
        - usage_service.go: 删除未使用的 calculateStats 函数
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      682f546c
    • yangjianbo's avatar
      fix(数据层): 修复数据完整性与仓储一致性问题 · 5906f9ab
      yangjianbo authored
      ## 数据完整性修复 (fix-critical-data-integrity)
      - 添加 error_translate.go 统一错误转换层
      - 修复 nil 输入和 NotFound 错误处理
      - 增强仓储层错误一致性
      
      ## 仓储一致性修复 (fix-high-repository-consistency)
      - Group schema 添加 default_validity_days 字段
      - Account schema 添加 proxy edge 关联
      - 新增 UsageLog ent schema 定义
      - 修复 UpdateBalance/UpdateConcurrency 受影响行数校验
      
      ## 数据卫生修复 (fix-medium-data-hygiene)
      - UserSubscription 添加软删除支持 (SoftDeleteMixin)
      - RedeemCode/Setting 添加硬删除策略文档
      - account_groups/user_allowed_groups 的 created_at 声明 timestamptz
      - 停止写入 legacy users.allowed_groups 列
      - 新增迁移: 011-014 (索引优化、软删除、孤立数据审计、列清理)
      
      ## 测试补充
      - 添加 UserSubscription 软删除测试
      - 添加迁移回归测试
      - 添加 NotFound 错误测试
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      5906f9ab
  16. 30 Dec, 2025 1 commit
    • yangjianbo's avatar
      fix(仓储): 修复查询关闭错误并迁移集成测试 · aacbc98a
      yangjianbo authored
      修复 rows.Close 失败时的错误返回逻辑
      迁移网关路由集成测试到 ent 事务基建
      补齐仓储接口变更对应的测试桩方法
      新增 backend/Makefile 统一测试命令
      测试: GOTOOLCHAIN=go1.24.11 go test ./...
      测试: golangci-lint run ./... --timeout=5m
      测试: make test-integration
      aacbc98a
  17. 29 Dec, 2025 5 commits
    • Junming Chen's avatar
      19d0ee13
    • yangjianbo's avatar
      fix(仓储): 修复软删除过滤与事务测试 · ae191f72
      yangjianbo authored
      修复软删除拦截器使用错误,确保默认查询过滤已删记录
      仓储层改用 ent.Tx 与扫描辅助,避免 sql.Tx 断言问题
      同步更新集成测试以覆盖事务与统计变动
      ae191f72
    • yangjianbo's avatar
      fix(用户): 修复删除用户软删除钩子 · 4dab18a9
      yangjianbo authored
      避免软删除钩子类型断言失败导致 500\n删除无记录时返回未找到错误并记录日志
      4dab18a9
    • yangjianbo's avatar
      fix(仓储层): 修复事务 ent client 调用 Close() 导致的 panic · 5584709a
      yangjianbo authored
      问题:创建用户时发生 panic,错误信息为
      "interface conversion: sql.ExecQuerier is *sql.Tx, not *sql.DB"
      
      原因:基于事务创建的 ent client 在调用 Close() 时,ent 的 sql driver
      会尝试将 ExecQuerier 断言为 *sql.DB 来关闭连接,但实际类型是 *sql.Tx
      
      修复:移除对 txClient.Close() 的调用,事务的清理通过
      sqlTx.Rollback() 和 sqlTx.Commit() 完成即可
      
      影响范围:
      - user_repo.go: Create 和 Update 方法
      - group_repo.go: Delete 方法
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      5584709a
    • yangjianbo's avatar
      refactor(数据库): 迁移持久层到 Ent 并清理 GORM · 3d617de5
      yangjianbo authored
      将仓储层/基础设施改为 Ent + 原生 SQL 执行路径,并移除 AutoMigrate 与 GORM 依赖。
      重构内容包括:
      - 仓储层改用 Ent/SQL(含 usage_log/account 等复杂查询),统一错误映射
      - 基础设施与 setup 初始化切换为 Ent + SQL migrations
      - 集成测试与 fixtures 迁移到 Ent 事务模型
      - 清理遗留 GORM 模型/依赖,补充迁移与文档说明
      - 增加根目录 Makefile 便于前后端编译
      
      测试:
      - go test -tags unit ./...
      - go test -tags integration ./...
      3d617de5
  18. 26 Dec, 2025 1 commit
  19. 25 Dec, 2025 1 commit
  20. 24 Dec, 2025 1 commit
  21. 23 Dec, 2025 1 commit