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 | |
| parent | b172d450e3a9dba8a56b2f6cd9e059559d232033 (diff) | |
add single client bug fixed (#1664)
| -rw-r--r-- | web/controller/inbound.go | 19 | ||||
| -rw-r--r-- | web/html/xui/inbounds.html | 2 |
2 files changed, 7 insertions, 14 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) { diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index e5d4b821..faff7a0f 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -964,7 +964,7 @@ settings: '{"clients": [' + clients.toString() + ']}', }; - await this.submit(`/panel/inbound/addClient`, data, true) + await this.submit(`/panel/inbound/addClient`, data) }, async addGroupClient(clients, dbInboundIds) { |
