refactor: nodes analytics (#847)

* refactor: nodes analytics

* feat(debug): add pprof in debug mode

* refactor: websocket error handler
This commit is contained in:
Jacky 2025-02-05 17:25:29 +08:00
parent b1ba719cb1
commit cb4977e5ab
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
17 changed files with 276 additions and 155 deletions

View file

@ -3,6 +3,8 @@ package router
import (
"net/http"
"github.com/gin-contrib/pprof"
"github.com/0xJacky/Nginx-UI/api/analytic"
"github.com/0xJacky/Nginx-UI/api/certificate"
"github.com/0xJacky/Nginx-UI/api/cluster"
@ -23,6 +25,7 @@ import (
"github.com/0xJacky/Nginx-UI/internal/middleware"
"github.com/gin-gonic/gin"
"github.com/uozi-tech/cosy"
cSettings "github.com/uozi-tech/cosy/settings"
)
func InitRouter() {
@ -45,6 +48,9 @@ func InitRouter() {
// Authorization required and not websocket request
g := root.Group("/", middleware.AuthRequired(), middleware.Proxy())
{
if cSettings.ServerSettings.RunMode == gin.DebugMode {
pprof.Register(g)
}
user.InitUserRouter(g)
analytic.InitRouter(g)
user.InitManageUserRouter(g)