Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorHo3ein <ho3ein.sanaei@gmail.com>2023-04-04 19:39:49 +0300
committerGitHub <noreply@github.com>2023-04-04 19:39:49 +0300
commitd8e0c958e78cb9ba5dae49c2c52377f7bee7393e (patch)
tree978b3178c6dd5bb616d46a442d8c50b19856bb70 /web
parent0e5de1aec8f3b090fce14638d7e0030ff7b7f40f (diff)
parent9f18d60b9ce16d89af97ae993a3224bb6c8cd288 (diff)
Merge pull request #153 from mohammadmovaghari/api-fix
Api fix
Diffstat (limited to 'web')
-rw-r--r--web/controller/api.go83
1 files changed, 57 insertions, 26 deletions
diff --git a/web/controller/api.go b/web/controller/api.go
index 84ac9c20..843ac7e5 100644
--- a/web/controller/api.go
+++ b/web/controller/api.go
@@ -1,48 +1,79 @@
package controller
-import (
- "github.com/gin-gonic/gin"
-)
-type APIController struct {
- BaseController
+import "github.com/gin-gonic/gin"
- inboundController *InboundController
- settingController *SettingController
+type APIController struct {
+ BaseController
+ inboundController *InboundController
+ settingController *SettingController
}
func NewAPIController(g *gin.RouterGroup) *APIController {
- a := &APIController{}
- a.initRouter(g)
- return a
+ a := &APIController{}
+ a.initRouter(g)
+ return a
}
func (a *APIController) initRouter(g *gin.RouterGroup) {
- g = g.Group("/xui/API/inbounds")
- g.Use(a.checkLogin)
+ g = g.Group("/xui/API/inbounds")
+ g.Use(a.checkLogin)
- g.GET("/", a.inbounds)
- g.GET("/get/:id", a.inbound)
- g.POST("/add", a.addInbound)
- g.POST("/del/:id", a.delInbound)
- g.POST("/update/:id", a.updateInbound)
+ g.POST("/list", a.getAllInbounds)
+ g.GET("/get/:id", a.getSingleInbound)
+ g.POST("/add", a.addInbound)
+ g.POST("/del/:id", a.delInbound)
+ 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) {
- a.inboundController.getInbounds(c)
+func (a *APIController) getAllInbounds(c *gin.Context) {
+ a.inboundController.getInbounds(c)
}
-func (a *APIController) inbound(c *gin.Context) {
- a.inboundController.getInbound(c)
+
+func (a *APIController) getSingleInbound(c *gin.Context) {
+ a.inboundController.getInbound(c)
}
+
func (a *APIController) addInbound(c *gin.Context) {
- a.inboundController.addInbound(c)
+ a.inboundController.addInbound(c)
}
+
func (a *APIController) delInbound(c *gin.Context) {
- a.inboundController.delInbound(c)
+ a.inboundController.delInbound(c)
}
+
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)
}