fix(inbounds): let a node-adopted inbound keep its own protocol on edit

UpdateInbound restores the stored NodeID before the node-eligibility check, so
the payload can never introduce an assignment there — the check could only ever
fire on a row that already had one. A node's MTProto inbound arrives on the
master by adoption, which does not go through that check, so every later edit of
it was refused with "mtproto inbounds cannot be assigned to a node". That made
the share address of a node-managed MTProto inbound impossible to change from
the panel that generates its subscription links.

Refuse only a protocol change into an ineligible protocol, which is the one way
an update can still strand a row the master's sidecar loops would never
reconcile.

Closes #6415
This commit is contained in:
Sanaei
2026-09-09 00:24:01 +02:00
parent bc57548a35
commit 2004340d1d
2 changed files with 70 additions and 1 deletions
+3 -1
View File
@@ -1598,7 +1598,9 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
// Restore the stored NodeID before the port-conflict check so a node inbound
// stays scoped to its own node (the payload's nodeId is unreliable, often absent).
inbound.NodeID = oldInbound.NodeID
if inbound.NodeID != nil && !isNodeEligibleProtocol(inbound.Protocol) {
// The node assignment is the stored one, so only a protocol change can
// introduce one; a row adopted from a node keeps the protocol it arrived with.
if inbound.NodeID != nil && inbound.Protocol != oldInbound.Protocol && !isNodeEligibleProtocol(inbound.Protocol) {
return inbound, false, common.NewErrorf("%s inbounds cannot be assigned to a node", inbound.Protocol)
}