feat: register NodeController routes and nodes page

- Add nodeController field and route group in api.go
- Add /panel/nodes page route in xui.go
- Verified node.go does not add duplicate checkAdmin middleware
This commit is contained in:
root 2026-04-24 17:08:52 +08:00
parent 16eb179eaf
commit cb4b1eba85
2 changed files with 15 additions and 3 deletions

View file

@ -12,9 +12,10 @@ import (
// APIController handles the main API routes for the 3x-ui panel, including inbounds and server management.
type APIController struct {
BaseController
inboundController *InboundController
serverController *ServerController
userController *UserController
inboundController *InboundController
serverController *ServerController
userController *UserController
nodeController *NodeController
Tgbot service.Tgbot
}
@ -58,6 +59,11 @@ func (a *APIController) initRouter(g *gin.RouterGroup) {
users.Use(a.checkAdmin)
a.userController = NewUserController(users)
// Nodes API
nodes := api.Group("/nodes")
nodes.Use(a.checkAdmin)
a.nodeController = NewNodeController(nodes)
// Extra routes
api.GET("/backuptotgbot", a.checkAdmin, a.BackuptoTgbot)
}

View file

@ -33,6 +33,7 @@ func (a *XUIController) initRouter(g *gin.RouterGroup) {
g.GET("/inbounds", a.checkAdmin, a.inbounds)
g.GET("/settings", a.checkAdmin, a.settings)
g.GET("/xray", a.checkAdmin, a.xraySettings)
g.GET("/nodes", a.checkAdmin, a.nodes)
g.GET("/users", a.checkAdmin, a.users)
a.settingController = NewSettingController(g)
@ -69,6 +70,11 @@ func (a *XUIController) xraySettings(c *gin.Context) {
html(c, "xray.html", "pages.xray.title", nil)
}
// nodes renders the node management page.
func (a *XUIController) nodes(c *gin.Context) {
html(c, "nodes.html", "pages.nodes.title", nil)
}
// users renders the admin user management page.
func (a *XUIController) users(c *gin.Context) {
html(c, "users.html", "pages.users.title", nil)