add single client bug fixed (#1664)

This commit is contained in:
Ali Rahimi 2024-01-23 11:00:21 +01:00 committed by GitHub
parent b172d450e3
commit 538fc9b365
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 14 deletions

View file

@ -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)
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) {

View file

@ -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) {