fix: remote agent exec url_path_prefix error

This commit is contained in:
engigu
2026-01-14 10:17:19 +08:00
parent f5f6affd7a
commit eef2baddd8
+8 -2
View File
@@ -216,6 +216,12 @@ func Setup(c *Controllers) *gin.Engine {
agents.POST("/tokens", c.Agent.CreateToken) agents.POST("/tokens", c.Agent.CreateToken)
agents.DELETE("/tokens/:id", c.Agent.DeleteToken) agents.DELETE("/tokens/:id", c.Agent.DeleteToken)
} }
// Agent API(供前端调用,保持在 v1 下)
agentAPIv1 := authorized.Group("/agent")
{
agentAPIv1.GET("/download", c.Agent.Download)
}
} }
} }
@@ -225,8 +231,8 @@ func Setup(c *Controllers) *gin.Engine {
agentAPI.POST("/heartbeat", c.Agent.Heartbeat) agentAPI.POST("/heartbeat", c.Agent.Heartbeat)
agentAPI.GET("/tasks", c.Agent.GetTasks) agentAPI.GET("/tasks", c.Agent.GetTasks)
agentAPI.POST("/report", c.Agent.ReportResult) agentAPI.POST("/report", c.Agent.ReportResult)
agentAPI.GET("/download", c.Agent.Download) agentAPI.GET("/download", c.Agent.Download) // 也在这里注册,兼容 Agent 调用
agentAPI.GET("/ws", c.Agent.WSConnect) // WebSocket 连接 agentAPI.GET("/ws", c.Agent.WSConnect) // WebSocket 连接
} }
// SPA fallback - serve index.html (no cache for HTML) // SPA fallback - serve index.html (no cache for HTML)