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:
authorMHSanaei <ho3ein.sanaei@gmail.com>2024-01-24 20:20:58 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2024-01-24 20:20:58 +0300
commit979fdedbbe1f36962bf72349ba21de4223286227 (patch)
tree2254ace8f853a6f54f91345600d6fb7a48dfd20e /web/service
parent2463b99479c3cb20ea8c1b907f498d665551621c (diff)
[bug] avoid empty inbound
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/service')
-rw-r--r--web/service/inbound.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go
index 2a4966ab..f3445101 100644
--- a/web/service/inbound.go
+++ b/web/service/inbound.go
@@ -317,7 +317,6 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
oldInbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port)
}
-
needRestart := false
s.xrayApi.Init(p.GetAPIPort())
if s.xrayApi.DelInbound(tag) == nil {
@@ -509,6 +508,10 @@ func (s *InboundService) DelInboundClient(inboundId int, clientId string) (bool,
}
}
+ if len(newClients) == 0 {
+ return false, common.NewError("no client remained in Inbound")
+ }
+
settings["clients"] = newClients
newSettings, err := json.MarshalIndent(settings, "", " ")
if err != nil {