750 Commits

Author SHA1 Message Date
Feng Yue
94eed70cf2 fix: disable user API keys when user account is disabled
Security enhancement to prevent disabled users from using API keys:

- Auto-disable all API keys when user is disabled/deleted
- Add user status validation during API key authentication
- Prevent API usage even if key is active but user is disabled
- Add comprehensive logging for security audit trail

This ensures disabled users cannot bypass restrictions through
existing API keys and maintains system security integrity.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 16:25:42 +08:00
Feng Yue
6b4ce99237 fix: usage stats issue 2025-08-14 16:16:27 +08:00
Feng Yue
c80446ae98 fix: include deletion metadata in user API keys response
- Add isDeleted, deletedAt, deletedBy, deletedByType fields to getUserApiKeys service method
- Include deletion fields in user routes API keys response
- Add debug logging to dashboard component to troubleshoot deleted keys count
- Ensure frontend can properly identify and count deleted API keys

This fixes the issue where deleted API keys count was always showing 0
instead of the actual number of deleted keys.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 16:02:11 +08:00
Feng Yue
4509f303e6 feat: enhance user API keys view and fix admin cost display
- Add deleted API keys display to user's My API Keys view
- Show deleted status with gray indicator and "Deleted" badge
- Display deletion date and hide delete button for deleted keys
- Fix cost calculation in admin deleted API keys tab
- Add getCostStats call to properly populate cost data
- Support includeDeleted parameter in user API keys endpoint

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 15:25:22 +08:00
Wesley Liddick
1144b9b5ff Merge pull request #246 from iRubbish/feat/webhook-account-notification
feat: 添加账号禁用异常状态 Webhook 通知功能 (已格式化)
2025-08-14 14:31:14 +08:00
iRubbish
2b77fdc06c fix: 修复 ESLint 代码质量问题
- 修复正则表达式中不必要的转义字符
- 使用对象解构优化代码风格
- 修复未使用变量的命名规范
- 确保所有修改文件通过 ESLint 检查

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 14:14:01 +08:00
Feng Yue
aff9966ed1 feat: management of deleted keys 2025-08-14 12:42:39 +08:00
Feng Yue
5d850a7c1c chore: remove regenerate api key functionality 2025-08-14 11:59:42 +08:00
Feng Yue
70e87de639 fix: user stats in admin panel again 2025-08-14 11:38:57 +08:00
Feng Yue
9efe429912 fix: user stats in admin panel 2025-08-14 11:38:51 +08:00
Feng Yue
8ea150a975 feat: enhance user API key management and implement soft delete
- Redirect users to API Keys tab after login instead of overview
- Remove Token Limit and Daily Cost Limit from user API key details modal
- Implement soft delete for API keys to preserve usage statistics
- Add admin endpoint to view deleted API keys with metadata
- Track deletion metadata (deletedBy, deletedAt, deletedByType)
- Ensure deleted API keys cannot be restored
- Include deleted key stats in user totals while excluding from active count

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 11:38:46 +08:00
Feng Yue
c413fddec0 fix: user stats again x4 2025-08-14 11:38:41 +08:00
Feng Yue
1ba55401f9 fix: user stats again again again 2025-08-14 11:38:36 +08:00
Feng Yue
983cc520ae fix: user stats again again 2025-08-14 11:38:32 +08:00
Feng Yue
02a801c290 fix: user stats again 2025-08-14 11:38:27 +08:00
Feng Yue
2756671117 fix: user stats 2025-08-14 11:38:23 +08:00
Feng Yue
bb60df8b41 chore: redirect back to login page for deactivated users 2025-08-14 11:38:08 +08:00
Feng Yue
aa86e062f1 fix: user apiKey creation issue 2025-08-14 11:38:04 +08:00
Feng Yue
4a1423615f chore: add debug log for LDAP auth 2025-08-14 11:37:59 +08:00
Feng Yue
d8af7959e2 fix: LDAP authentication string validation error
Add comprehensive input validation for LDAP authentication:
- Validate bindDN, bindCredentials, userDN, and password parameters
- Add configuration validation during service initialization
- Enhanced error messages for missing/invalid LDAP settings
- Prevent "stringToWrite must be a string" errors from ldapjs client
- Added null/undefined checks for all LDAP credential parameters

This fixes authentication errors when LDAP configuration values
are missing, empty, or of incorrect type.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 11:37:45 +08:00
Feng Yue
1f3fd9c285 chore: support LDAPS 2025-08-14 11:37:38 +08:00
Feng Yue
39c6e3146c fix: redis issue in user management 2025-08-14 11:37:32 +08:00
Feng Yue
eb150b4937 feat: 实现完整用户管理系统和LDAP认证集成
- 新增LDAP认证服务支持用户登录验证
- 实现用户服务包含会话管理和权限控制
- 添加用户专用路由和API端点
- 扩展认证中间件支持用户和管理员双重身份
- 新增用户仪表板、API密钥管理和使用统计界面
- 完善前端用户管理组件和路由配置
- 支持用户自助API密钥创建和管理
- 添加管理员用户管理功能包含角色权限控制

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 11:36:45 +08:00
shaw
5428462f55 fix: 修复 OpenAI 账户代理配置保存问题
- 修复 OAuth 方式添加 OpenAI 账户时缺少 priority 字段
- 修复创建 OpenAI 账户时错误检查 proxy.enabled 导致代理未保存
- 添加 OpenAI OAuth token 交换时的 SOCKS5 代理支持
- 添加 OpenAI API 请求转发时的代理支持
- 参考 Claude/Gemini 实现统一代理处理逻辑
2025-08-13 22:44:48 +08:00
weidian
e01e539108 feat: 添加账号异常状态 Webhook 通知功能
## 功能概述
- 新增账号禁用/异常状态的 Webhook 实时通知机制
- 支持 Claude OAuth、Claude Console、Gemini 三种平台的账号监控
- 提供完整的 Webhook 管理 API 和配置选项

## 主要变更

### 新增文件
- `src/utils/webhookNotifier.js`: Webhook 通知核心服务
- `src/routes/webhook.js`: Webhook 管理 API 路由

### 功能集成
- Claude OAuth 账号:unauthorized 状态 + token 刷新错误通知
- Claude Console 账号:blocked 状态通知
- Gemini 账号:token 刷新错误通知

### 配置支持
- 新增环境变量:WEBHOOK_ENABLED, WEBHOOK_URLS, WEBHOOK_TIMEOUT, WEBHOOK_RETRIES
- 支持多个 Webhook URL 并发通知
- 自动重试机制(指数退避)+ 超时保护

### 管理端点
- POST /admin/webhook/test: 测试连通性
- POST /admin/webhook/test-notification: 发送测试通知
- GET /admin/webhook/config: 查看配置信息

## 通知格式
```json
{
  "type": "account_anomaly",
  "data": {
    "accountId": "uuid",
    "accountName": "账号名称",
    "platform": "claude-oauth|claude-console|gemini",
    "status": "unauthorized|blocked|error",
    "errorCode": "CLAUDE_OAUTH_UNAUTHORIZED",
    "reason": "具体异常原因",
    "timestamp": "2025-01-13T10:30:00.000Z"
  }
}
```

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 17:52:46 +08:00
Wesley Liddick
ceb1749859 Merge pull request #243 from tanaer/fixed
Fixed: 新增 Claude Console 账户限流机制开关
2025-08-13 17:49:47 +08:00
wt
8142c3356a feat: 新增 Claude Console 账户限流机制开关 Lint format 2025-08-13 17:04:47 +08:00
wt
ab02acd008 Prettier format 2025-08-13 15:04:47 +08:00
wt
f9e8157e07 Fix: Claude Console 账户的限流开关 2025-08-13 11:24:20 +08:00
shaw
2cd56c1174 fix: 修复OpenAI账户统计问题
- 添加缺失的recordUsage方法,统一updateAccountUsage实现
- 优化模型支持检查逻辑,未设置supportedModels时支持所有模型
- 修复gpt-5模型请求被拒绝的问题

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 09:54:06 +08:00
shaw
4ca9674772 feat: 完善多平台账户管理和API Keys页面展示
- 修复OpenAI路由中的gpt-5模型ID处理
- 增强统一调度器的账户选择日志输出
- 优化OAuth流程中的账户类型处理
- 完善API Keys页面的多平台账户信息展示

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 17:55:45 +08:00
Wesley Liddick
b250b6ee3b Merge pull request #235 from tanaer/feature
feat: 新增 Claude Console 账户限流机制开关
2025-08-12 16:21:10 +08:00
shaw
3a563b8dd2 fix: 优化 OpenAI Codex API 的 gpt-5 模型 ID 处理
- 自动将 gpt-5-xxx 格式的模型 ID 标准化为 gpt-5
- 解决 Codex API 不接受具体版本模型 ID 的问题
- 添加日志记录模型标准化过程

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 15:50:34 +08:00
wt
6dfaf637aa feat: 新增 Claude Console 账户限流机制开关 2025-08-12 15:48:41 +08:00
shaw
b06fa5efe8 fix: 修复OpenAI类型账号数据统计问题
- 修复API Key请求次数、费用、token统计无法记录的问题
- 修复OpenAI账户今日使用统计显示空白的问题
- 修复模型使用详情记录缺失的问题
- 统一OpenAI账户统计数据格式与其他平台保持一致

主要修改:
1. openaiRoutes.js: 将req.apiKeyData改为req.apiKey,与中间件保持一致
2. admin.js: 为OpenAI账户列表接口添加使用统计获取逻辑

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 14:21:01 +08:00
Wesley Liddick
c761b4f3c7 Merge pull request #234 from tanaer/bugfix
Fixes: Gemini账户调度状态在页面刷新后与实际设置不符
2025-08-11 17:08:59 +08:00
wt
0f66ea7d4a Fixes: Gemini账户调度状态在页面刷新后与实际设置不符 2025-08-11 16:48:34 +08:00
shaw
ed1f23152d fix: redis服务改为expose并支持Codex cli的api转发 2025-08-11 15:54:59 +08:00
shaw
4643bd8aad fix: 解决Codex cli转发流式响应中断问题 2025-08-11 14:40:02 +08:00
shaw
f462684f97 feat: 实现OpenAI账户管理和统一调度系统
- 新增 OpenAI 账户管理服务,支持多账户轮询和负载均衡
- 实现统一的 OpenAI API 调度器,智能选择最优账户
- 优化成本计算器,支持更精确的 token 计算
- 更新模型定价数据,包含最新的 OpenAI 模型价格
- 增强 API Key 管理,支持更灵活的配额控制
- 改进管理界面,添加教程视图和账户分组管理
- 优化限流配置组件,提供更直观的用户体验

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 13:58:43 +08:00
千羽
5d9c8216ac chore: commit all changes 2025-08-10 19:09:56 +09:00
千羽
11fc856999 chore: commit all changes 2025-08-10 17:46:31 +09:00
Wesley Liddick
e09c1dda12 Merge pull request #227 from mouyong/dev-local
增强账户管理页面的平台筛选和缓存优化功能
2025-08-10 13:25:02 +08:00
mouyong
4bcd2878f2 feat: 增强账户管理页面的平台筛选和缓存优化功能
- 添加平台筛选功能到账户管理页面
  * 后端:在所有账户接口中支持platform和groupId查询参数
  * 前端:添加平台筛选下拉框,支持条件性API请求

- 使用智能缓存机制优化数据加载
  * 缓存API Keys、账户分组和分组成员数据
  * 通过Ctrl/⌘+点击刷新按钮实现强制重新加载
  * 在数据变更时自动清除相关缓存(创建/编辑/删除)

- 改进Gemini账户限流状态显示
  * 在geminiAccountService中添加限流信息支持
  * 统一所有平台的限流状态格式
  * 修复仪表板统计,排除被限流的账户

- 提升用户界面体验
  * 将原生title提示替换为Element Plus的el-tooltip组件
  * 支持跨平台键盘快捷键(Ctrl/⌘+点击)
  * ESLint规范合规和代码格式化改进

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-10 12:40:24 +08:00
KevinLiao
87775c9fb1 fix: 修复Claude Console账号模型映射的的流式响应 2025-08-10 08:46:26 +08:00
mouyong
8bdf495ffa feat: enhance monitoring and Gemini service functionality
- Add enhanced monitoring scripts (monitor-enhanced.sh, status-unified.sh)
- Improve Gemini relay service with better error handling and token management
- Update authentication middleware for better compatibility
- Add new package dependencies for enhanced functionality
- Update .gitignore and app configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-09 14:06:56 +08:00
shaw
7e1a9daa6b feat: 完善管理界面功能和用户体验
- 添加 API Key 窗口倒计时组件 (WindowCountdown)
- 添加自定义下拉菜单组件 (CustomDropdown)
- 优化账户和 API Key 管理界面交互
- 改进教程页面布局和说明文字
- 完善账户状态显示和错误处理

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 14:14:46 +08:00
shaw
4adc8d9695 恢复并保存本地修改:仪表盘服务账户分类显示、WindowCountdown组件等功能 2025-08-08 11:56:24 +08:00
shaw
31bdb4aa8c feat: add comprehensive 401 error handling and account status management
- Add 401 error detection and automatic account suspension after 3 consecutive failures
- Implement account status reset functionality for clearing all error states
- Enhance admin interface with status reset controls and improved status display
- Upgrade service management script with backup protection and retry mechanisms
- Add mandatory code formatting requirements using Prettier
- Improve account selector with detailed status information and color coding

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 00:35:26 +08:00
千羽
35e16038a5 feat: add Setup Token OAuth flow for simplified Claude account setup
Introduces a streamlined Setup Token authentication method that reduces the required OAuth scopes from 'org:create_api_key user:profile user:inference' to just 'user:inference', simplifying the account setup process for users who only need inference capabilities.

Key changes:
- Add Setup Token authorization endpoints in admin routes
- Implement Setup Token OAuth flow with PKCE support in oauthHelper
- Update AccountForm to support Setup Token as the default auth method
- Add automatic authorization code extraction from callback URLs
- Maintain full proxy configuration support for Setup Token flow
- Preserve existing OAuth flow for advanced users requiring API key creation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 22:48:48 +09:00