Commit Graph
19 Commits
Author SHA1 Message Date
hermes b275de31a7 feat(protect): 正确处理一个 pfx 里有多张证书的情况
Docker Build / Build and Push Docker Image (push) Successful in 59s
Docker Build / Deploy to Server (push) Successful in 3s
用户问:我的 pfx 可能一个文件包含很多个证书,能处理吗?
实测三种形态,行为全部对齐签名工具(osslsigncode / OpenSSL PKCS12_parse):

1) 单身份(1 证书 + 1 私钥):普通情况。
2) 链式(叶子 + 中间 CA + 根,证书多但私钥一把):这是好事,签名会把整条链
   写进去,验签更容易过。原来「取第一个证书当签名证书」的做法在这里是错的
   —— 链包里第一张可能是中间 CA。改为按「公钥与私钥配对」认叶子证书。
3) 多身份(一个文件里好几套 私钥+证书):签名工具只会用第一套,原来完全没提示。
   现在上传时就解析出每套身份(序号/主题/到期),库里存 cert_count / key_count,
   列表显示「2 张 / 2 套私钥」,加壳页选中时明确提示「仅使用第一套(CN=…)」。

其它:
- 只有证书没有私钥的 pfx 直接拒(原来会存下来,直到加壳时才炸),报错翻成人话
- 解析全部纯 Go(go-pkcs12 + 自解析 PKCS#1/SEC1),因为生产镜像是 Alpine 没有 openssl CLI
- 签名证书列表新增「证书数」列;schema 补 cert_count/key_count

实测(keytool 造 2 套私钥 p12、openssl 造 3 张链式 pfx、cert-only pfx):
- 单证书 → 1 张 / 1 把
- 链式   → 3 张 / 1 把,签名证书正确识别为叶子;osslsigncode verify 产物里
           同时含 Leaf Signer 与 Test Root CA(链完整)
- 多身份 → 2 张 / 2 把,身份列表 Signer A + Signer B;实际签名者为 Signer A,
           与面板报告一致(不是按到期时间瞎排序)
- 只有证书 → 400「这个文件里只有证书、没有私钥(不是标准 pfx),签不了名」
2026-11-22 11:21:11 +08:00
hermes 10347aa330 refactor(model): 从根上消除 device_id 字段歧义,撤掉迁移特例
Docker Build / Build and Push Docker Image (push) Successful in 30s
Docker Build / Deploy to Server (push) Successful in 2s
上一版用 skipMigrateOnMySQL 绕过了 GORM 的误判,属于打补丁。真正的根因是
DeviceSession.DeviceID 与 UserDevice.DeviceID 同名,GORM 推断外键时选错对象。

- DeviceSession.DeviceID → UserDeviceID,tag 钉死 column:device_id 与索引名
  idx_device_sessions_device_id(与线上现有索引同名,不产生任何 DDL 变更)
- 双向关系显式写 foreignKey:UserDeviceID;references:ID
- 删除 skipMigrateOnMySQL 及相关预检函数,AutoMigrate 恢复对这些表的正常管理
- JSON 键仍为 device_id,接口不变;所有 Go 引用同步改名

验证:全新 sqlite 建库列/索引与线上一致;老库登录后 device_sessions 正确写入
user_devices.id;四处 PRAGMA 的 sqlite 守卫保留
2026-11-21 22:15:30 +08:00
admin ed73bb470c feat: agent devices/sessions filter by agent-associated users only
- Add created_by field to AppUser model to track who created the user
- Set created_by when agent creates users
- Extract getAgentUserIDs() helper: finds users who recharged with agent/sub-agent cards OR were created by agent/sub-agent
- Extract getAgentAppIDs() helper: finds agent's authorized applications
- Refactor handleGetUsers and checkAgentUserPermission to use getAgentUserIDs
- Create agent-specific handleGetDevices: filter by agent user IDs + app IDs
- Create agent-specific handleGetSessions: filter by agent user IDs + app IDs
- Replace admin handler references with agent-specific handlers for GET routes
2026-05-11 11:53:43 +08:00
admin 853c22fdbe feat: add balance display, user columns, device mgmt and sessions for agent
- Backend: add balance to agent stats API
- Backend: return full user details (balance, expiry, online_status, device_count, application) in agent users API
- Backend: export admin device/session handlers, add agent routes for devices and sessions
- Backend: add card type permission check and balance deduction for agent user creation
- Backend: extract checkAgentUserPermission helper, add user edit API
- Frontend: add balance card to agent dashboard
- Frontend: add application, online_status, device_count, balance, expiry_at columns to agent user table
- Frontend: add agent devices page (reuse admin data-table component)
- Frontend: add agent sessions page (reuse admin data-table component)
- Frontend: add devices and sessions to agent navigation and routes
- Add i18n keys for agent devices, sessions, user columns, dashboard balance
2026-05-11 10:46:29 +08:00
admin a76a30ee78 feat: add agent user edit, card type permission check and balance deduction
- Backend: check AgentApplicationCardType.can_generate before allowing card recharge
- Backend: deduct agent balance and record consumption when creating user with card
- Backend: add GET /agent/users/:id and PUT /agent/users/:id for user edit
- Backend: extract checkAgentUserPermission helper, refactor handleUpdateUserStatus
- Frontend: add user edit page ([id].vue) with username/email/password
- Frontend: add edit action in user list dropdown menu
- Frontend: add route for agent user edit page
- Add i18n keys for agent user edit
2026-05-11 08:48:02 +08:00
admin 57e1d10689 feat: add user creation and ban/unban for agent backend
- Backend: POST /agent/users - create user with optional card recharge
- Backend: PUT /agent/users/:id/status - ban/unban user
- Frontend: add create user page for agent (select app, card type)
- Frontend: add ban/unban action in user list with confirm dialog
- Frontend: add actions dropdown column in user data table
- Fix: cloud variables records page i18n key (agent.finance.to -> agent.cloudVariables.records.to)
- Add i18n keys for agent user management (create, ban, unban)
2026-05-11 08:24:30 +08:00
admin 3cea807353 refactor: change agent cloud data permission to cloud variables only
- Rename permission from '查看云端数据' to '查看云端变量'
- Remove cloud constants API and page for agents
- Add cloud variable records API for agents (stream type)
- Add agent cloud-variables page with full variable details
- Add agent cloud-variable records page (read-only)
- Update navigation from cloud-data to cloud-variables
- Update i18n keys: cloudData -> cloudVariables
- Backend returns var_type, default_value, max_records etc.
- Records page supports dynamic columns and date filtering
2026-05-11 08:05:40 +08:00
admin 6dcb5cde02 fix: add can_view_cloud_data to login and profile API responses
- Add can_view_cloud_data field to auth login response
- Add can_view_cloud_data field to agent profile response
- Fetch latest user permissions from /agent/profile on agent layout mount
- Update localStorage with latest can_view_cloud_data value
2026-05-11 00:15:21 +08:00
admin df4ad079f3 fix: agent finance page styling and cloud data API implementation
- Fix agent finance page: confirmed backend integration is working
- Add agent cloud-variables and cloud-constants API endpoints
- Rewrite agent cloud-data page to use real API calls instead of mock data
- Fix API path: /agent/applications -> /agent/apps
- Remove 'all' value from app filter SelectItem (empty string issue)
- Add cloudData i18n keys for zh and en
- Cloud data is read-only for agents, with CanViewCloudData permission check
2026-05-10 23:38:04 +08:00
admin 409ec4f75b 修复: 1.管理员编辑代理云端数据权限switch无效(后端缺少CanViewCloudData字段) 2.代理卡密status显示disabledbanned 3.代理用户管理只显示代理/子代理卡密充值过的用户 2026-05-10 14:12:35 +08:00
admin f3b9feca6a agent后台finance和users添加服务端分页和统计 2026-05-10 08:41:49 +08:00
admin c495f9b417 修复代理商卡密管理页面:增加服务端筛选、批量导出、复制功能 2026-05-10 04:27:55 +08:00
adminandClaude Opus 4.7 83cd822717 fix: 修复代理卡密统计和列表查询逻辑
- 前端使用后端返回的total字段显示总数
- 后端查询条件兼容旧数据(agent_id IS NULL AND creator_id = ?)
- handleGetStats统计接口使用相同查询逻辑

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 02:36:26 +08:00
adminandClaude Opus 4.7 d83e7dfac9 fix: 添加代理生成卡密余额检查和扣费逻辑
- 检查代理余额是否足够
- 检查并限制生成数量(1-100)
- 使用事务确保数据一致性
- 扣除代理余额
- 记录消费记录

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 02:20:45 +08:00
adminandClaude Opus 4.7 0cc3e85714 fix: 修复代理卡密列表数据不显示问题
- Card模型添加AgentID字段
- 生成卡密时设置AgentID
- handleGetCards返回正确格式的数据(包含app_name, card_type_name, code等)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 02:04:45 +08:00
adminandClaude Opus 4.7 a2ce784ac0 fix: 修复代理生成卡密权限检查和参数问题
- 后端兼容application_id和app_id参数
- 添加卡类权限检查,确保代理只能生成有权限的卡类
- 前端使用application_id参数名
- 移除卡类显示中的billing_type原始值,改为显示价格

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 01:16:28 +08:00
adminandClaude Opus 4.7 e63753a853 feat: 添加代理获取应用详情和卡类列表API
- 添加 GET /agent/apps/:id 接口
- 返回代理有权使用的卡类列表及其价格

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 23:58:34 +08:00
admin 4ed00f29e2 refactor: 移除佣金比例字段,将developer统一为admin 2026-05-01 08:08:11 +08:00
Admin 5c63882e71 更新开发者平台:代理商管理、版本管理、UI优化 2026-04-29 15:19:17 +08:00