Files
OpenFlare/internal/router/v1/openflare/register_agent.go
T
ryan ce736e2de4 feat(pages): pull latest by project and keep a single edge release
Agents now treat pages_project_id as the stable anchor and fetch the
control-plane active package via project latest APIs, so activating a
deployment updates edges without republishing main config. Local roots use
projects/{id}/current, only the newest release is retained after a successful
switch, hash/package races retry, and per-project failures no longer block
siblings.
2026-07-17 17:43:40 +08:00

35 lines
1.3 KiB
Go

// Copyright 2026 Arctel.net
// SPDX-License-Identifier: Apache-2.0
package openflare
import (
"github.com/Rain-kl/Wavelet/internal/apps/openflare/agent"
"github.com/gin-gonic/gin"
)
func registerAgentRoutes(apiV1Router *gin.RouterGroup) {
agentRoute := apiV1Router.Group("/agent")
{
discoveryRoute := agentRoute.Group("/")
discoveryRoute.Use(agent.RegisterAuth())
{
discoveryRoute.POST("/nodes/register", agent.RegisterHandler)
}
authorizedRoute := agentRoute.Group("/")
authorizedRoute.Use(agent.Auth())
{
authorizedRoute.GET("/ws", agent.WebSocketHandler)
authorizedRoute.POST("/nodes/heartbeat", agent.HeartbeatHandler)
authorizedRoute.GET("/config-versions/active", agent.GetActiveConfigHandler)
authorizedRoute.GET("/pages/deployments/:deployment_id/hash", agent.GetPagesDeploymentHashHandler)
authorizedRoute.GET("/pages/deployments/:deployment_id/package", agent.DownloadPagesPackageHandler)
authorizedRoute.GET("/pages/projects/:project_id/latest/hash", agent.GetPagesProjectLatestHashHandler)
authorizedRoute.GET("/pages/projects/:project_id/latest/package", agent.DownloadPagesProjectLatestPackageHandler)
authorizedRoute.POST("/waf/ip-groups/sync", agent.SyncWAFIPGroupsHandler)
authorizedRoute.POST("/apply-logs", agent.ReportApplyLogHandler)
}
}
}