Commit Graph

24 Commits

Author SHA1 Message Date
admin 97dbd76414 fix: 修复检测更新 API 使用正确的字段名
- 将 status 字段改为 publish_status
- 将 active 值改为 published
- 确保能正确查询已发布的版本

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 02:54:02 +08:00
admin 551f4f1576 feat: auto-generate full package when uploading patch
- Add FullPackagePath, FullPackageSize, FullPackageHash to Version model
- When uploading patch, merge with base full package to create new full package
- Check update API returns full package info for download
- Add package_util.go with merge functions

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 11:43:58 +08:00
admin 275698a32b fix: return param error when version not found in database
Change 404 to 400 with "版本号参数错误" message

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 13:21:54 +08:00
admin 7af4da30d3 feat: return latest version when no version param provided
If client doesn't provide version parameter, return latest version info
instead of returning error

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 13:11:13 +08:00
admin 65a9465af4 fix: logout requires both device_id and instance_id
Only clear specific instance on specific device
Remove cross-device and all-instances clearing

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 18:24:23 +08:00
admin 008e66f84e fix: require instance_id when device_id is provided on logout
- Only device_id without instance_id returns error
- Three valid combinations:
  - device_id + instance_id: clear specific instance
  - only instance_id: clear instance across devices
  - no params: clear all instances

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 18:20:33 +08:00
admin ab3f188c04 fix: logout only clears instances, not devices
- Remove device deletion on logout
- Only delete DeviceSession records
- Support clearing specific instance or all instances

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 18:18:31 +08:00
admin f5343281a3 feat: add app user routes (logout, user-info, avatar, tickets)
- Logout: clear device sessions on logout
- User info: return expiry/balance based on billing type
- Avatar upload: support jpg/png/gif/webp, max 2MB
- App tickets: create, reply, close tickets for app users
- Add ClosedAt field to Ticket model

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 18:09:05 +08:00
admin 5298f8f58e feat: return expiry/balance based on billing type on login
- Return expiry_at for subscription mode
- Return balance for usage-based mode
- Return is_permanent for permanent members

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 17:58:33 +08:00
admin 16c68a855b fix: version display and comparison issues
- Remove duplicate 'v' prefix in version display
- Add version string cleanup (trim spaces, remove v/V prefix)
- Use custom download URL when set
- Fix has_update logic for same version comparison

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 16:53:46 +08:00
admin ed4a561704 feat: add application API documentation and C++ SDK
- Add complete API documentation for application integration (docs/API_DOCUMENT.md)
- Fix check-update API to use version ID comparison instead of string comparison
- Add validation: client version must exist in server version list
- Add support for patch/incremental updates with base_version check
- Add C++ SDK with HTTP client, JSON parser, and crypto support
- Add simple_test.cpp for standalone testing on Windows

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 11:58:44 +08:00
admin 65fa7146e8 refactor: 拆分更新类型(全量/补丁)和更新方式(自动/手动),移除force_update字段 2026-05-08 23:34:14 +08:00
admin de0de10b8d refactor: 移除min_version/base_version_id,后端自动确定基础版本 2026-05-08 23:17:53 +08:00
admin 375fd46224 fix: 修复云端变量记录data为null的问题
- 后端: handleAddRecord增加recordData nil检查,避免存入null
- 后端: 记录读取改用interface{}替代map[string]interface{}解析JSON
- 后端: JSON解析失败时回退返回原始字符串
- 后端: API返回raw_data字段暴露数据库原始数据用于诊断
- 后端: app/cloud.go同步修复同样的JSON解析问题
- 前端: parseRecordData增加raw_data回退解析
- 前端: 添加数据诊断卡片显示原始数据结构
2026-05-08 02:31:15 +08:00
admin 8811511ff8 refactor: 删除未实现的 call-function API
- 该功能与 dynamic-code/:key/execute 重复
- 保持代码整洁,移除无用代码
2026-05-07 13:22:43 +08:00
admin 6bdffcd90f fix: 云端函数区分当前用户和目标用户
- user 始终为当前登录用户(从 token 获取)
- 新增 targetUser 变量,当请求参数指定 user_id 时注入
- 同时注入 targetSubscription、targetUserVariables、targetDevices
2026-05-07 13:15:23 +08:00
admin 551eff2f60 fix: 云端函数默认注入当前登录用户信息
- 当请求参数未指定 user_id 时,使用 token 中的用户 ID
- 确保 user、subscription、devices 等变量始终有值
2026-05-07 13:13:18 +08:00
admin 086c5c6573 perf: 性能优化与错误修复
- 修复 N+1 查询: users/devices/agents 批量 GROUP BY 替代循环查询
- 添加分页: cards/finance/agents/devices API
- Redis 初始化根据安装配置 redis.enabled 决定是否连接
- 修复 DefaultVal 解析错误: 使用 sql.NullString 处理 NULL 值
- Dashboard 优化: 替换 ECharts 世界地图为 Chart.js 环形饼图
- 适配前端 cards 页面新 API 响应格式
- 添加数据库索引优化查询性能
- 实现可配置的数据清理定时任务
2026-05-06 19:19:02 +08:00
admin 98986b0eb7 fix: 修复数据库配置和事务一致性问题
数据库配置:
- SQLite 开启 WAL 模式,读写可并发
- 设置 busy_timeout=5000ms 避免锁超时
- 设置 synchronous=NORMAL 平衡性能和安全
- SQLite MaxOpenConns 设为 1 避免并发写入冲突

事务修复:
- auth.go: 注册流程(用户+设备+会话)加入事务
- auth.go: 密码重置(修改密码+标记验证码)加入事务
- cards.go: 卡密使用加入事务,补充 UsedAt 字段
- cards.go: 代理商批量生成(扣款+生成卡密)加入事务
- extension.go: 充值(修改余额+记录)加入事务
- extension.go: 扣费(修改余额+记录)加入事务
- storage_config.go: 设置默认存储加入事务
2026-05-06 08:12:04 +08:00
admin 9262d066bb fix: JWT密钥同步、地图初始化时序、API中间件错误处理
- 修复安装完成后JWT密钥未同步到viper内存的问题
- 修复地图在loading状态时DOM元素不存在导致的初始化错误
- 修复AppCryptoMiddleware中数据库错误时未正确返回错误响应的问题
- 添加数据库未初始化检查
- 移除调试日志输出
2026-05-04 02:22:23 +08:00
admin 1f7dfd17a7 feat: 分离密码重置和修改密码功能
- 密码重置:用户忘记密码时通过邮箱/短信验证(需开启开关)
- 修改密码:已登录用户通过旧密码修改(固定功能,无需配置)
- 添加 EnablePasswordReset 开关控制密码重置功能
- PasswordResetMethod 只支持 email/sms 两种验证方式
- 添加短信配置管理功能
- 移除独立的应用邮箱设置页面
2026-05-03 01:18:27 +08:00
admin ea8ffb6c74 fix: 订阅模式登录验证、永久会员类型区分、动态代码HTTP返回值修复、侧边栏滚动位置保持
- 修复订阅模式登录时错误检查余额的问题
- 区分无限余额和永久订阅两种永久会员类型
- 修复动态代码HTTP请求返回值在JS中无法正确访问的问题
- 添加侧边栏滚动位置保持功能
- 移除developer角色相关代码,统一使用admin
- 添加缺失的i18n翻译key
2026-05-01 16:39:31 +08:00
admin 10044b474f feat: 添加云端函数HTTP请求、SMTP邮件、数据库操作能力
- 添加HTTP客户端工具支持GET/POST请求
- 添加SMTP邮件发送功能
- 添加数据库操作(db.getRecords, db.deleteRecord, db.deleteRecords)
- 添加订单管理云端函数(读取、接收、筛选、成功、失败)
- 添加测试推送和邮件通知云端函数
- 修复云端函数编辑页面预览代码换行显示
- 云端变量数据模型重构(合并数据类型)
2026-04-30 20:54:02 +08:00
Admin afe67d704e Initial commit: 网络验证平台 2026-04-27 17:22:56 +08:00