fix(inbounds): keep disabled clients out of the core when adding an inbound

The running core must only see clients the panel has enabled, and
UpdateInbound and SetInboundEnable already build their payload through
buildInboundForLocalRuntime, which strips disabled ones. AddInbound used
it only for MTProto and TUIC and hot-added the stored row for every
other protocol, so an imported or pushed inbound re-armed its disabled
clients until the next restart.

AddInbound now builds the runtime payload the same way for every
protocol.
This commit is contained in:
MHSanaei
2026-11-01 13:26:10 +01:00
parent 2e41f908db
commit 5a6d40e3ff
2 changed files with 60 additions and 10 deletions
+7 -10
View File
@@ -1574,17 +1574,14 @@ func (s *InboundService) AddInbound(inbound *model.Inbound) (*model.Inbound, boo
return perr
}
if push {
payload := inbound
pushable := true
if inbound.Protocol == model.MTProto || inbound.Protocol == model.TUIC {
if built, bErr := s.buildInboundForLocalRuntime(tx, inbound); bErr == nil {
payload = built
} else {
logger.Debug("Unable to prepare runtime inbound config:", bErr)
pushable = false
// An imported or master-pushed row lists its disabled and depleted clients too.
payload, bErr := s.buildInboundForLocalRuntime(tx, inbound)
if bErr != nil {
logger.Debug("Unable to prepare runtime inbound config:", bErr)
if inbound.Protocol != model.MTProto && inbound.Protocol != model.TUIC {
needRestart = true
}
}
if pushable {
} else {
postCommitApply = func() {
if err1 := rt.AddInbound(context.Background(), payload); err1 == nil {
logger.Debug("New inbound added on", rt.Name(), ":", inbound.Tag)