diff --git a/web/controller/inbound.go b/web/controller/inbound.go index a86c21e8..9ca03696 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -31,7 +31,7 @@ func (a *InboundController) initRouter(g *gin.RouterGroup) { g.POST("/add", a.addInbound) g.POST("/del/:id", a.delInbound) g.POST("/update/:id", a.updateInbound) - g.POST("/addClient/", a.addInboundClient) + g.POST("/addClient", a.addInboundClient) g.POST("/delClient/:email", a.delInboundClient) g.POST("/updateClient/:index", a.updateInboundClient) g.POST("/:id/resetClientTraffic/:email", a.resetClientTraffic) @@ -129,19 +129,19 @@ func (a *InboundController) updateInbound(c *gin.Context) { } func (a *InboundController) addInboundClient(c *gin.Context) { - inbound := &model.Inbound{} - err := c.ShouldBind(inbound) + data := &model.Inbound{} + err := c.ShouldBind(data) if err != nil { jsonMsg(c, I18n(c, "pages.inbounds.revise"), err) return } - err = a.inboundService.AddInboundClient(inbound) + err = a.inboundService.AddInboundClient(data) if err != nil { jsonMsg(c, "something worng!", err) return } - jsonMsg(c, "Client added", nil) + jsonMsg(c, "Client(s) added", nil) if err == nil { a.xrayService.SetToNeedRestart() } diff --git a/web/html/xui/client_bulk_modal.html b/web/html/xui/client_bulk_modal.html index defef3a0..5361dd62 100644 --- a/web/html/xui/client_bulk_modal.html +++ b/web/html/xui/client_bulk_modal.html @@ -150,7 +150,6 @@ confirm: null, dbInbound: new DBInbound(), inbound: new Inbound(), - clients: [], quantity: 1, totalGB: 0, expiryTime: '', @@ -164,6 +163,7 @@ flow: "", delayedStart: false, ok() { + clients = []; method=clientsBulkModal.emailMethod; if(method>1){ start=clientsBulkModal.firstNum; @@ -186,9 +186,9 @@ if(clientsBulkModal.inbound.canEnableTlsFlow()){ newClient.flow = clientsBulkModal.flow; } - clientsBulkModal.clients.push(newClient); + clients.push(newClient); } - ObjectUtil.execute(clientsBulkModal.confirm, clientsBulkModal.inbound, clientsBulkModal.dbInbound); + ObjectUtil.execute(clientsBulkModal.confirm, clients, clientsBulkModal.dbInbound.id); }, show({ title='', okText='{{ i18n "sure" }}', dbInbound=null, confirm=(inbound, dbInbound)=>{} }) { this.visible = true; @@ -208,7 +208,6 @@ this.flow= ""; this.dbInbound = new DBInbound(dbInbound); this.inbound = dbInbound.toInbound(); - this.clients = this.getClients(this.inbound.protocol, this.inbound.settings); this.delayedStart = false; }, getClients(protocol, clientSettings) { diff --git a/web/html/xui/client_modal.html b/web/html/xui/client_modal.html index 7b207244..37b1919b 100644 --- a/web/html/xui/client_modal.html +++ b/web/html/xui/client_modal.html @@ -12,6 +12,7 @@ confirmLoading: false, title: '', okText: '', + isEdit: false, dbInbound: new DBInbound(), inbound: new Inbound(), clients: [], @@ -20,9 +21,13 @@ isExpired: false, delayedStart: false, ok() { - ObjectUtil.execute(clientModal.confirm, clientModal.inbound, clientModal.dbInbound, clientModal.index); + if(clientModal.isEdit){ + ObjectUtil.execute(clientModal.confirm, clientModalApp.client, clientModal.dbInbound.id, clientModal.index); + } else { + ObjectUtil.execute(clientModal.confirm, clientModalApp.client, clientModal.dbInbound.id); + } }, - show({ title='', okText='{{ i18n "sure" }}', index=null, dbInbound=null, confirm=(index, dbInbound)=>{}, isEdit=false }) { + show({ title='', okText='{{ i18n "sure" }}', index=null, dbInbound=null, confirm=()=>{}, isEdit=false }) { this.visible = true; this.title = title; this.okText = okText; diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index d34a6bbe..a57d006a 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -209,11 +209,10 @@ {{template "js" .}}