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:
authorAzavax <21226881+azavaxhuman@users.noreply.github.com>2025-07-23 00:43:48 +0300
committerGitHub <noreply@github.com>2025-07-23 00:43:48 +0300
commitb1ab156e42ed0e68b49e89df45d44b6ad0ea02ff (patch)
treee4ffb3297e38afaf54e625065ab2886b25f5fc1c /web/controller/inbound.go
parentfa45bf87de469f9e7f79c90b4381de5b9e4f58d2 (diff)
Endpoint for updating client traffic by email (#3259)
* Update api.go * Update inbound.go * Update inbound.go
Diffstat (limited to 'web/controller/inbound.go')
-rw-r--r--web/controller/inbound.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/web/controller/inbound.go b/web/controller/inbound.go
index 592a4bd0..a89f224f 100644
--- a/web/controller/inbound.go
+++ b/web/controller/inbound.go
@@ -339,3 +339,28 @@ func (a *InboundController) delDepletedClients(c *gin.Context) {
func (a *InboundController) onlines(c *gin.Context) {
jsonObj(c, a.inboundService.GetOnlineClients(), nil)
}
+
+func (a *InboundController) updateClientTraffic(c *gin.Context) {
+ email := c.Param("email")
+
+ // Define the request structure for traffic update
+ type TrafficUpdateRequest struct {
+ Upload int64 `json:"upload"`
+ Download int64 `json:"download"`
+ }
+
+ var request TrafficUpdateRequest
+ err := c.ShouldBindJSON(&request)
+ if err != nil {
+ jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), err)
+ return
+ }
+
+ err = a.inboundService.UpdateClientTrafficByEmail(email, request.Upload, request.Download)
+ if err != nil {
+ jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
+ return
+ }
+
+ jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundClientUpdateSuccess"), nil)
+}