diff --git a/web/controller/inbound.go b/web/controller/inbound.go index a89f224f..851b4b6f 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -108,8 +108,8 @@ func (a *InboundController) addInbound(c *gin.Context) { jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err) return } - jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundCreateSuccess"), inbound, err) - if err == nil && needRestart { + jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundCreateSuccess"), inbound, nil) + if needRestart { a.xrayService.SetToNeedRestart() } } @@ -126,8 +126,8 @@ func (a *InboundController) delInbound(c *gin.Context) { jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err) return } - jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundDeleteSuccess"), id, err) - if err == nil && needRestart { + jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundDeleteSuccess"), id, nil) + if needRestart { a.xrayService.SetToNeedRestart() } } @@ -152,8 +152,8 @@ func (a *InboundController) updateInbound(c *gin.Context) { jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err) return } - jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), inbound, err) - if err == nil && needRestart { + jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), inbound, nil) + if needRestart { a.xrayService.SetToNeedRestart() } } @@ -342,25 +342,25 @@ func (a *InboundController) onlines(c *gin.Context) { 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) }