mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-05 12:45:00 +03:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user