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-09 22:43:18 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2023-04-09 22:43:18 +0300
commite1da43053d23c995bcd6e7267cb20042398cd64f (patch)
tree08c4c371ba070ef765ec2be83270ee6032e54774 /web/controller/inbound.go
parent3bb90cbf2463b31c6a921f7cd75cf32edd3a37f0 (diff)
alireza update pack
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/controller/inbound.go')
-rw-r--r--web/controller/inbound.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/web/controller/inbound.go b/web/controller/inbound.go
index b567af8c..f7ea35eb 100644
--- a/web/controller/inbound.go
+++ b/web/controller/inbound.go
@@ -37,6 +37,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)
}
@@ -131,7 +133,7 @@ func (a *InboundController) updateInbound(c *gin.Context) {
func (a *InboundController) getClientIps(c *gin.Context) {
email := c.Param("email")
- ips , err := a.inboundService.GetInboundClientIps(email)
+ ips, err := a.inboundService.GetInboundClientIps(email)
if err != nil {
jsonObj(c, "No IP Record", nil)
return
@@ -230,3 +232,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)
+}