mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 21:42:24 +00:00
fix api in net 3-xui panel
This commit is contained in:
parent
87acb81496
commit
45469e9f64
1 changed files with 57 additions and 26 deletions
|
@ -1,11 +1,9 @@
|
||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import "github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
type APIController struct {
|
type APIController struct {
|
||||||
BaseController
|
BaseController
|
||||||
|
|
||||||
inboundController *InboundController
|
inboundController *InboundController
|
||||||
settingController *SettingController
|
settingController *SettingController
|
||||||
}
|
}
|
||||||
|
@ -20,29 +18,62 @@ func (a *APIController) initRouter(g *gin.RouterGroup) {
|
||||||
g = g.Group("/xui/API/inbounds")
|
g = g.Group("/xui/API/inbounds")
|
||||||
g.Use(a.checkLogin)
|
g.Use(a.checkLogin)
|
||||||
|
|
||||||
g.GET("/", a.inbounds)
|
g.POST("/list", a.getAllInbounds)
|
||||||
g.GET("/get/:id", a.inbound)
|
g.GET("/get/:id", a.getSingleInbound)
|
||||||
g.POST("/add", a.addInbound)
|
g.POST("/add", a.addInbound)
|
||||||
g.POST("/del/:id", a.delInbound)
|
g.POST("/del/:id", a.delInbound)
|
||||||
g.POST("/update/:id", a.updateInbound)
|
g.POST("/update/:id", a.updateInbound)
|
||||||
|
g.POST("/clientIps/:email", a.getClientIps)
|
||||||
|
g.POST("/clearClientIps/:email", a.clearClientIps)
|
||||||
|
g.POST("/addClient/", a.addInboundClient)
|
||||||
|
g.POST("/delClient/:email", a.delInboundClient)
|
||||||
|
g.POST("/updateClient/:index", a.updateInboundClient)
|
||||||
|
g.POST("/:id/resetClientTraffic/:email", a.resetClientTraffic)
|
||||||
|
|
||||||
a.inboundController = NewInboundController(g)
|
a.inboundController = NewInboundController(g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (a *APIController) inbounds(c *gin.Context) {
|
func (a *APIController) getAllInbounds(c *gin.Context) {
|
||||||
a.inboundController.getInbounds(c)
|
a.inboundController.getInbounds(c)
|
||||||
}
|
}
|
||||||
func (a *APIController) inbound(c *gin.Context) {
|
|
||||||
|
func (a *APIController) getSingleInbound(c *gin.Context) {
|
||||||
a.inboundController.getInbound(c)
|
a.inboundController.getInbound(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *APIController) addInbound(c *gin.Context) {
|
func (a *APIController) addInbound(c *gin.Context) {
|
||||||
a.inboundController.addInbound(c)
|
a.inboundController.addInbound(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *APIController) delInbound(c *gin.Context) {
|
func (a *APIController) delInbound(c *gin.Context) {
|
||||||
a.inboundController.delInbound(c)
|
a.inboundController.delInbound(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *APIController) updateInbound(c *gin.Context) {
|
func (a *APIController) updateInbound(c *gin.Context) {
|
||||||
a.inboundController.updateInbound(c)
|
a.inboundController.updateInbound(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *APIController) getClientIps(c *gin.Context) {
|
||||||
|
a.inboundController.getClientIps(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *APIController) clearClientIps(c *gin.Context) {
|
||||||
|
a.inboundController.clearClientIps(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *APIController) addInboundClient(c *gin.Context) {
|
||||||
|
a.inboundController.addInboundClient(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *APIController) delInboundClient(c *gin.Context) {
|
||||||
|
a.inboundController.delInboundClient(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *APIController) updateInboundClient(c *gin.Context) {
|
||||||
|
a.inboundController.updateInboundClient(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *APIController) resetClientTraffic(c *gin.Context) {
|
||||||
|
a.inboundController.resetClientTraffic(c)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue