huangzhenpc
2d77047287
Merge upstream/main: v0.1.61 updates with TOTP & password reset
...
CI / test (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
Security Scan / backend-security (push) Has been cancelled
Security Scan / frontend-security (push) Has been cancelled
Major features:
- feat(auth): add TOTP (2FA) support for enhanced security
- feat(auth): add password reset functionality
- feat(openai): improve rate limit handling with reset time tracking
- feat(subscription): add expiry notification service
- fix(urlvalidator): remove trailing slash from validated URLs
- docs: update demo site domain
Resolved conflicts:
- deploy/docker-compose.yml: added TOTP_ENCRYPTION_KEY config
- setting_service.go: keep TianShuAPI site name while adding new features
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-01-26 10:35:33 +08:00
huangzhenpc
dc42bf585b
chore: use 1panel docker-compose config as default
...
- Replace docker-compose.yml with docker-compose.1panel.yml content
- Better compatibility with 1Panel environment
- Simplify future updates and maintenance
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-01-26 10:32:46 +08:00
shaw
1245f07a2d
feat(auth): 实现 TOTP 双因素认证功能
...
新增功能:
- 支持 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
2026-01-26 09:19:53 +08:00
shaw
27291f2e5f
fix(docker): 修改 Redis 配置以支持可选的密码设置
2026-01-09 17:28:55 +08:00
Edric Li
38d875b06f
feat(update): 添加在线更新和定价数据获取的代理支持
...
针对国内服务器访问 GitHub 困难的问题,为在线更新和定价数据获取功能添加代理支持。
主要变更:
- 新增 update.proxy_url 配置项,支持 http/https/socks5/socks5h 协议
- 修改 GitHubReleaseClient 和 PricingRemoteClient 支持代理配置
- 更新 Wire 依赖注入,通过 Provider 函数传递配置
- 更新 Docker 配置文件,支持通过 UPDATE_PROXY_URL 环境变量设置代理
配置示例:
update:
proxy_url: "http://127.0.0.1:7890 "
Docker 环境变量:
UPDATE_PROXY_URL=http://host.docker.internal:7890
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-07 23:15:20 +08:00
yangjianbo
17ae51c0a0
merge: 合并远程分支并修复代码冲突
...
合并了远程分支 cb72262 的功能更新,同时保留了 ESLint 修复:
**冲突解决详情:**
1. AccountTableFilters.vue
- ✅ 保留 emit 模式修复(避免 vue/no-mutating-props 错误)
- ✅ 添加第三个筛选器 type(账户类型)
- ✅ 新增 antigravity 平台和 inactive 状态选项
2. UserBalanceModal.vue
- ✅ 保留 console.error 错误日志
- ✅ 添加输入验证(金额校验、余额不足检查)
- ✅ 使用 appStore.showError 向用户显示友好错误
3. AccountsView.vue
- ✅ 保留所有 console.error 错误日志(避免 no-empty 错误)
- ✅ 使用新 API:clearRateLimit 和 setSchedulable
4. UsageView.vue
- ✅ 添加 console.error 错误日志
- ✅ 添加图表功能(模型分布、使用趋势)
- ✅ 添加粒度选择(按天/按小时)
- ✅ 保留 XLSX 动态导入优化
**测试结果:**
- ✅ Go tests: PASS
- ✅ golangci-lint: 0 issues
- ✅ ESLint: 0 errors
- ✅ TypeScript: PASS
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-06 12:50:51 +08:00
yangjianbo
3f0017d1f1
fix(安全): 修复依赖漏洞并强化安全扫描
...
主要改动:
- 固定 Go 1.25.5 与 CI 校验并更新扫描流程
- 升级 quic-go、x/crypto、req 等依赖并通过 govulncheck
- 强化 JWT 校验、TLS 配置与 xlsx 动态加载
- 新增审计豁免清单与校验脚本
2026-01-06 11:36:38 +08:00
shaw
2920409404
docs: 更新 Docker 部署文档强调 JWT_SECRET 配置重要性
...
- docker-compose.yml: 添加注释说明设置固定 JWT_SECRET 可防止容器重启后登录失效
- .env.example: 添加 openssl rand -hex 32 生成安全密钥的命令
2026-01-06 09:44:54 +08:00
yangjianbo
5668736389
fix(依赖): 更新 Redis 镜像版本至 8-alpine
2026-01-05 15:54:47 +08:00
yangjianbo
1aef4ce20d
fix(部署): 配置文件挂载改为可选,避免 Docker 自动创建目录
...
当挂载的源文件不存在时,Docker 会自动创建同名目录而非文件。
将配置文件挂载默认注释,用户需要时先创建文件再取消注释。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-05 15:50:29 +08:00
Jiahao Luo
204190f807
feat(crs-sync): improve error messages and add private IP allowlist support
...
## 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
2026-01-05 12:57:03 +08:00
ianshaw
118ca5cf6d
fix: 修复空content处理及更新Gemini使用指南链接
...
- 修复FilterThinkingBlocksForRetry对空content数组的处理
- docker-compose添加SECURITY_URL_ALLOWLIST_UPSTREAM_HOSTS配置
- 更新Gemini使用指南链接:检查归属地、修改归属地、激活Gemini Web
2026-01-04 18:26:39 -08:00
IanShaw027
06d483fa8d
feat(backend): implement gemini quota simulation and rate limiting
...
- feat: add local quota tracking for gemini tiers (Legacy/Pro/Ultra)
- feat: implement PreCheckUsage in RateLimitService
- feat: align gemini daily reset window with PST
- fix: sticky session fallback logic
2026-01-01 04:29:22 +08:00
yangjianbo
5376786694
chore(配置): 提升容器文件描述符上限到10万
...
调整原因:
- 防止高并发下出现 "too many open files" 错误
- 统一测试与生产环境的 ulimits 配置
改动内容:
- 为 sub2api、postgres、redis 设置 nofile
- 软硬限制均为 100000
测试: 未运行
2025-12-30 20:28:41 +08:00
IanShaw027
ecfad788d9
feat(全栈): 实现简易模式核心功能
...
**功能概述**:
实现简易模式(Simple Mode),为个人用户和小团队提供简化的使用体验,隐藏复杂的分组、订阅、配额等概念。
**后端改动**:
1. 配置系统
- 新增 run_mode 配置项(standard/simple)
- 支持环境变量 RUN_MODE
- 默认值为 standard
2. 数据库初始化
- 自动创建3个默认分组:anthropic-default、openai-default、gemini-default
- 默认分组配置:无并发限制、active状态、非独占
- 幂等性保证:重复启动不会重复创建
3. 账号管理
- 创建账号时自动绑定对应平台的默认分组
- 如果未指定分组,自动查找并绑定默认分组
**前端改动**:
1. 状态管理
- authStore 新增 isSimpleMode 计算属性
- 从后端API获取并同步运行模式
2. UI隐藏
- 侧边栏:隐藏分组管理、订阅管理、兑换码菜单
- 账号管理页面:隐藏分组列
- 创建/编辑账号对话框:隐藏分组选择器
3. 路由守卫
- 限制访问分组、订阅、兑换码相关页面
- 访问受限页面时自动重定向到仪表板
**配置示例**:
```yaml
run_mode: simple
run_mode: standard
```
**影响范围**:
- 后端:配置、数据库迁移、账号服务
- 前端:认证状态、路由、UI组件
- 部署:配置文件示例
**兼容性**:
- 简易模式和标准模式可无缝切换
- 不需要数据迁移
- 现有数据不受影响
2025-12-29 03:24:15 +08:00
shaw
94749b12ac
chore: 调整deploy说明以及取消postgres端口暴露
2025-12-27 21:14:08 +08:00
IanShaw027
bfcd9501c2
merge: 合并 upstream/main 解决 PR #37 冲突
...
- 删除 backend/internal/model/account.go 符合重构方向
- 合并最新的项目结构重构
- 包含 SSE 格式解析修复
- 更新依赖和配置文件
2025-12-26 21:56:08 +08:00
shaw
ecb2c5353c
fix: 修复docker-compose.yml redis密码传递问题
2025-12-26 17:25:12 +08:00
ianshaw
79d1585250
docs(deploy): 更新部署配置和文档
...
- .env.example: 新增 Gemini OAuth 环境变量配置示例
- config.example.yaml: 新增 Gemini OAuth 配置示例
- README.md: 更新部署文档
- docker-compose.yml: 添加 Gemini OAuth 环境变量传递
2025-12-26 00:11:03 -08:00
ianshaw
e36fb98fb9
feat(handler): 添加 Gemini OAuth Handler 和完善依赖注入
...
- 新增 Gemini OAuth 授权处理器
- 扩展账号和网关处理器支持 Gemini
- 注册 Gemini 相关路由
- 更新 Wire 依赖注入配置(所有层)
- 更新 Docker Compose 配置
2025-12-26 00:09:46 -08:00
shaw
5fca2d10b9
fix: 修复image地址
2025-12-25 16:57:29 +08:00
ianshaw
2e76302af7
feat(account): 添加批量编辑账户凭据功能并优化 CRS 同步
...
- 新增批量更新账户凭据接口(account_uuid/org_uuid/intercept_warmup_requests)
- 新增前端批量编辑模态框组件
- 优化 CRS 同步逻辑,改进 extra 字段处理
- 优化 CRS 同步 UI,添加更详细的结果展示
- 完善国际化文案(中英文)
2025-12-24 16:56:48 -08:00
shaw
078529e51e
chore: 更新docker的postgres版本为18
2025-12-19 16:42:03 +08:00
shaw
642842c29e
First commit
2025-12-18 13:50:39 +08:00