diff --git a/web/controller/inbound.go b/web/controller/inbound.go index 904e88a1..a86c21e8 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -35,6 +35,8 @@ func (a *InboundController) initRouter(g *gin.RouterGroup) { g.POST("/delClient/:email", a.delInboundClient) g.POST("/updateClient/:index", a.updateInboundClient) g.POST("/:id/resetClientTraffic/:email", a.resetClientTraffic) + g.POST("/resetAllTraffics", a.resetAllTraffics) + g.POST("/resetAllClientTraffics/:id", a.resetAllClientTraffics) } @@ -208,3 +210,27 @@ func (a *InboundController) resetClientTraffic(c *gin.Context) { a.xrayService.SetToNeedRestart() } } + +func (a *InboundController) resetAllTraffics(c *gin.Context) { + err := a.inboundService.ResetAllTraffics() + if err != nil { + jsonMsg(c, "something worng!", err) + return + } + jsonMsg(c, "All traffics reseted", nil) +} + +func (a *InboundController) resetAllClientTraffics(c *gin.Context) { + id, err := strconv.Atoi(c.Param("id")) + if err != nil { + jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) + return + } + + err = a.inboundService.ResetAllClientTraffics(id) + if err != nil { + jsonMsg(c, "something worng!", err) + return + } + jsonMsg(c, "All traffics of client reseted", nil) +} diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 906c824b..05efb470 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -68,6 +68,7 @@
{{ i18n "pages.inbounds.addInbound" }} {{ i18n "pages.inbounds.export" }} + {{ i18n "pages.inbounds.resetAllTraffic" }}