Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Rahimi <alirahimi818@gmail.com>2024-01-21 17:26:19 +0300
committerGitHub <noreply@github.com>2024-01-21 17:26:19 +0300
commit5c695ca6520c9cd9c44b18119a862f8f480969af (patch)
tree56e739defaf1f1d0326cb30235b1cb6dcf2699e2 /web/controller
parente7ce8c8ddb8472695b296eac305c5ac9b8c1d3d8 (diff)
add group user with the same subscription id to all inbounds (#1650)
Diffstat (limited to 'web/controller')
-rw-r--r--web/controller/inbound.go39
1 files changed, 23 insertions, 16 deletions
diff --git a/web/controller/inbound.go b/web/controller/inbound.go
index 86da9813..b274be64 100644
--- a/web/controller/inbound.go
+++ b/web/controller/inbound.go
@@ -159,24 +159,31 @@ func (a *InboundController) clearClientIps(c *gin.Context) {
}
func (a *InboundController) addInboundClient(c *gin.Context) {
- data := &model.Inbound{}
- err := c.ShouldBind(data)
- if err != nil {
- jsonMsg(c, I18nWeb(c, "pages.inbounds.update"), err)
- return
- }
+ var requestData []model.Inbound
- needRestart := true
+ err := c.ShouldBindJSON(&requestData)
+
+ if err != nil {
+ jsonMsg(c, I18nWeb(c, "pages.inbounds.update"), err)
+ return
+ }
+
+ needRestart := true
+
+ for _, data := range requestData {
+
+ 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()
+ }
- 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) delInboundClient(c *gin.Context) {