|
@@ -108,8 +108,8 @@ func (a *InboundController) addInbound(c *gin.Context) {
|
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
|
return
|
|
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()
|
|
a.xrayService.SetToNeedRestart()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -126,8 +126,8 @@ func (a *InboundController) delInbound(c *gin.Context) {
|
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
|
return
|
|
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()
|
|
a.xrayService.SetToNeedRestart()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -152,8 +152,8 @@ func (a *InboundController) updateInbound(c *gin.Context) {
|
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
|
return
|
|
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()
|
|
a.xrayService.SetToNeedRestart()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -342,25 +342,25 @@ func (a *InboundController) onlines(c *gin.Context) {
|
|
|
|
|
|
func (a *InboundController) updateClientTraffic(c *gin.Context) {
|
|
func (a *InboundController) updateClientTraffic(c *gin.Context) {
|
|
email := c.Param("email")
|
|
email := c.Param("email")
|
|
-
|
|
|
|
|
|
+
|
|
// Define the request structure for traffic update
|
|
// Define the request structure for traffic update
|
|
type TrafficUpdateRequest struct {
|
|
type TrafficUpdateRequest struct {
|
|
Upload int64 `json:"upload"`
|
|
Upload int64 `json:"upload"`
|
|
Download int64 `json:"download"`
|
|
Download int64 `json:"download"`
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
var request TrafficUpdateRequest
|
|
var request TrafficUpdateRequest
|
|
err := c.ShouldBindJSON(&request)
|
|
err := c.ShouldBindJSON(&request)
|
|
if err != nil {
|
|
if err != nil {
|
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), err)
|
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), err)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
err = a.inboundService.UpdateClientTrafficByEmail(email, request.Upload, request.Download)
|
|
err = a.inboundService.UpdateClientTrafficByEmail(email, request.Upload, request.Download)
|
|
if err != nil {
|
|
if err != nil {
|
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundClientUpdateSuccess"), nil)
|
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundClientUpdateSuccess"), nil)
|
|
}
|
|
}
|