feat(agent): expose canonical /api/agent-server/v1/nodes

This commit is contained in:
Haitao Pan 2026-02-05 16:52:10 +08:00
parent 700a1db5e3
commit 4b4a2069b3
2 changed files with 12 additions and 4 deletions

View File

@ -301,6 +301,12 @@ func RegisterRoutes(r *gin.Engine, opts ...Option) {
}
registerAdminRoutes(apiGroup, h)
// Canonical user-facing agent routes under /api/agent-server/v1.
// Keep this in the authenticated user API group so dashboard requests can
// read registered nodes directly without console-side custom route logic.
agentServerGroup := apiGroup.Group("/agent-server/v1")
agentServerGroup.GET("/nodes", h.listAgentNodes)
// User agent routes - /api/agent/nodes
agentGroup := apiGroup.Group("/agent")
agentGroup.GET("/nodes", h.listAgentNodes)

View File

@ -34,9 +34,11 @@
> 说明:`/api/auth/admin/*` 需要管理员或运维角色。
## Agent API/api/agent/v1
## Agent API/api/agent-server/v1
- `GET /api/agent/v1/users`:获取 Xray 客户端列表
- `POST /api/agent/v1/status`:上报 Agent 状态
- `GET /api/agent-server/v1/nodes`:获取已注册节点列表(用户会话鉴权)
- `GET /api/agent-server/v1/users`:获取 Xray 客户端列表
- `POST /api/agent-server/v1/status`:上报 Agent 状态
Agent 认证通过 `Authorization: Bearer <agent-token>`
- `GET /nodes` 使用用户会话(`xc_session` / Bearer session token
- `GET /users``POST /status` 使用 Agent Token`Authorization: Bearer <agent-token>`