diff options
| author | Ali Rahimi <alirahimi818@gmail.com> | 2024-01-23 13:00:21 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-23 13:00:21 +0300 |
| commit | 538fc9b3656afe260af74a71828e15aa069e1434 (patch) | |
| tree | 8f251ffc4b062518f013f6ec8d02f404dc25d810 /web/controller | |
| parent | b172d450e3a9dba8a56b2f6cd9e059559d232033 (diff) | |
add single client bug fixed (#1664)
Diffstat (limited to 'web/controller')
| -rw-r--r-- | web/controller/inbound.go | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/web/controller/inbound.go b/web/controller/inbound.go index 4d6e0af0..0aa2e2df 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -162,10 +162,8 @@ func (a *InboundController) clearClientIps(c *gin.Context) { } func (a *InboundController) addInboundClient(c *gin.Context) { - var requestData []model.Inbound - - err := c.ShouldBindJSON(&requestData) - + data := &model.Inbound{} + err := c.ShouldBind(data) if err != nil { jsonMsg(c, I18nWeb(c, "pages.inbounds.update"), err) return @@ -173,20 +171,15 @@ func (a *InboundController) addInboundClient(c *gin.Context) { needRestart := true - for _, data := range requestData { - - needRestart, err = a.inboundService.AddInboundClient(&data) - if err != nil { - jsonMsg(c, "Something went wrong!", err) - return - } + needRestart, err = a.inboundService.AddInboundClient(data) + if err != nil { + jsonMsg(c, "Something went wrong!", err) + return } - jsonMsg(c, "Client(s) added", nil) if err == nil && needRestart { a.xrayService.SetToNeedRestart() } - } func (a *InboundController) addGroupInboundClient(c *gin.Context) { |
