feat(center): 新增通知实时推送 WS /ws/notifications,管理台建单秒达
挂到 Koa 同一 http.Server 的 upgrade 事件(复用 8800,不占新端口、不改 nginx),X-API-Token 握手鉴权,帧格式对齐执行机 notifier.js;新建通知后立即广播(target=all / account),GET /api/notifications 轮询继续兜底。 连接状态放模块作用域(生命周期挂载与请求内推送的 provider 实例不保证同一个),心跳 30s 清理半开连接;src/index.ts 补导出(bundle 关闭 moduleDetector 时必须显式导出)。 部署 SOP 增加 WS 端点探针,客户端交接文档补 /ws/notifications 契约。
This commit is contained in:
@@ -168,6 +168,7 @@ powershell -NoProfile -ExecutionPolicy Bypass -File scripts\build-python-env.ps1
|
||||
| 定时/流程备份 | `POST/GET /api/schedules/backup`(同一槽位含 `schedules` + `flows`) |
|
||||
| 运行备注 | `GET/POST /api/plugin-notes` |
|
||||
| 通知 / 头像 / 文件源列表 | `GET /api/notifications`、`GET /api/avatar/{account}`、`GET /api/file-sources/{category}` |
|
||||
| 通知实时推送(WS) | `WS /ws/notifications?account=<账号>`(握手头 `X-API-Token`),下行帧 `{"type":"notify","notification":{id,title,content,level,target,account}}`;与 HTTP 共用 8800 端口,连不上时仍由 `GET /api/notifications` 60s 轮询兜底 |
|
||||
| 凭证下发 | `POST /api/creds/register`、`GET /api/creds` |
|
||||
| 钉钉扫码 | `GET /api/dingtalk/login-url`、`POST /auth/exchange`(钉钉 code → 建号 + 云端 token) |
|
||||
|
||||
|
||||
@@ -143,6 +143,11 @@ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8800/api/shell/version
|
||||
curl -s http://127.0.0.1:8090/ | head -c 200
|
||||
# 文件服务器
|
||||
curl -s http://127.0.0.1:8802/
|
||||
# 通知 WS 端点已挂载(未带票据应为 401;返回 404 说明该版本后端还没有 /ws/notifications)
|
||||
curl -s -o /dev/null -w '%{http_code}\n' \
|
||||
-H 'Connection: Upgrade' -H 'Upgrade: websocket' -H 'Sec-WebSocket-Version: 13' \
|
||||
-H 'Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==' \
|
||||
'http://127.0.0.1:8800/ws/notifications?account=test'
|
||||
```
|
||||
|
||||
本机发版 CLI 预检:
|
||||
|
||||
Reference in New Issue
Block a user