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
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2023-04-24 14:37:11 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2023-04-24 14:37:11 +0300
commit16e3107d23b4bc536d509c2dd832d10366fb895e (patch)
tree3592c9b3d2cd703a73aeed971bed65c0c37a0fa6 /web/controller
parent262e3c0985c8c315c78f86370e8b338df9e69593 (diff)
Better client delete + api
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/controller')
-rw-r--r--web/controller/api.go2
-rw-r--r--web/controller/inbound.go11
2 files changed, 6 insertions, 7 deletions
diff --git a/web/controller/api.go b/web/controller/api.go
index c8ad2a67..b8da9243 100644
--- a/web/controller/api.go
+++ b/web/controller/api.go
@@ -26,7 +26,7 @@ func (a *APIController) initRouter(g *gin.RouterGroup) {
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("/:id/delClient/:clientId", a.delInboundClient)
g.POST("/updateClient/:index", a.updateInboundClient)
g.POST("/:id/resetClientTraffic/:email", a.resetClientTraffic)
g.POST("/resetAllTraffics", a.resetAllTraffics)
diff --git a/web/controller/inbound.go b/web/controller/inbound.go
index f32cb766..ec37dcc7 100644
--- a/web/controller/inbound.go
+++ b/web/controller/inbound.go
@@ -34,7 +34,7 @@ func (a *InboundController) initRouter(g *gin.RouterGroup) {
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("/:id/delClient/:clientId", a.delInboundClient)
g.POST("/updateClient/:index", a.updateInboundClient)
g.POST("/:id/resetClientTraffic/:email", a.resetClientTraffic)
g.POST("/resetAllTraffics", a.resetAllTraffics)
@@ -155,7 +155,7 @@ func (a *InboundController) clearClientIps(c *gin.Context) {
err := a.inboundService.ClearClientIps(email)
if err != nil {
- jsonMsg(c, "修改", err)
+ jsonMsg(c, "Revise", err)
return
}
jsonMsg(c, "Log Cleared", nil)
@@ -180,15 +180,14 @@ func (a *InboundController) addInboundClient(c *gin.Context) {
}
func (a *InboundController) delInboundClient(c *gin.Context) {
- email := c.Param("email")
- inbound := &model.Inbound{}
- err := c.ShouldBind(inbound)
+ id, err := strconv.Atoi(c.Param("id"))
if err != nil {
jsonMsg(c, I18n(c, "pages.inbounds.revise"), err)
return
}
+ clientId := c.Param("clientId")
- err = a.inboundService.DelInboundClient(inbound, email)
+ err = a.inboundService.DelInboundClient(id, clientId)
if err != nil {
jsonMsg(c, "something worng!", err)
return