mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-07 21:54:10 +00:00
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:
parent
16eb179eaf
commit
cb4b1eba85
2 changed files with 15 additions and 3 deletions
|
|
@ -12,9 +12,10 @@ import (
|
||||||
// APIController handles the main API routes for the 3x-ui panel, including inbounds and server management.
|
// APIController handles the main API routes for the 3x-ui panel, including inbounds and server management.
|
||||||
type APIController struct {
|
type APIController struct {
|
||||||
BaseController
|
BaseController
|
||||||
inboundController *InboundController
|
inboundController *InboundController
|
||||||
serverController *ServerController
|
serverController *ServerController
|
||||||
userController *UserController
|
userController *UserController
|
||||||
|
nodeController *NodeController
|
||||||
Tgbot service.Tgbot
|
Tgbot service.Tgbot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,6 +59,11 @@ func (a *APIController) initRouter(g *gin.RouterGroup) {
|
||||||
users.Use(a.checkAdmin)
|
users.Use(a.checkAdmin)
|
||||||
a.userController = NewUserController(users)
|
a.userController = NewUserController(users)
|
||||||
|
|
||||||
|
// Nodes API
|
||||||
|
nodes := api.Group("/nodes")
|
||||||
|
nodes.Use(a.checkAdmin)
|
||||||
|
a.nodeController = NewNodeController(nodes)
|
||||||
|
|
||||||
// Extra routes
|
// Extra routes
|
||||||
api.GET("/backuptotgbot", a.checkAdmin, a.BackuptoTgbot)
|
api.GET("/backuptotgbot", a.checkAdmin, a.BackuptoTgbot)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ func (a *XUIController) initRouter(g *gin.RouterGroup) {
|
||||||
g.GET("/inbounds", a.checkAdmin, a.inbounds)
|
g.GET("/inbounds", a.checkAdmin, a.inbounds)
|
||||||
g.GET("/settings", a.checkAdmin, a.settings)
|
g.GET("/settings", a.checkAdmin, a.settings)
|
||||||
g.GET("/xray", a.checkAdmin, a.xraySettings)
|
g.GET("/xray", a.checkAdmin, a.xraySettings)
|
||||||
|
g.GET("/nodes", a.checkAdmin, a.nodes)
|
||||||
g.GET("/users", a.checkAdmin, a.users)
|
g.GET("/users", a.checkAdmin, a.users)
|
||||||
|
|
||||||
a.settingController = NewSettingController(g)
|
a.settingController = NewSettingController(g)
|
||||||
|
|
@ -69,6 +70,11 @@ func (a *XUIController) xraySettings(c *gin.Context) {
|
||||||
html(c, "xray.html", "pages.xray.title", nil)
|
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.
|
// users renders the admin user management page.
|
||||||
func (a *XUIController) users(c *gin.Context) {
|
func (a *XUIController) users(c *gin.Context) {
|
||||||
html(c, "users.html", "pages.users.title", nil)
|
html(c, "users.html", "pages.users.title", nil)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue