From 538fc9b3656afe260af74a71828e15aa069e1434 Mon Sep 17 00:00:00 2001 From: Ali Rahimi Date: Tue, 23 Jan 2024 11:00:21 +0100 Subject: add single client bug fixed (#1664) --- web/controller/inbound.go | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'web/controller') 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) { -- cgit v1.2.3