mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-30 23:17:14 +00:00
fix(inbound): convert legacy externalProxy to hosts on import
An inbound exported from a build that predated the hosts table carries its external proxies inline in streamSettings.externalProxy. The startup migration that converts those to host rows runs once and is gated off afterwards, so it never sees a freshly imported inbound, leaving its external proxies stranded in streamSettings (never surfaced as Hosts). Extract the migration's per-inbound conversion into a shared database.CreateHostsFromExternalProxy and run it inside the AddInbound transaction. No-op for inbounds without externalProxy (everything the current UI builds), so it only fires on such imports.
This commit is contained in:
@@ -705,6 +705,16 @@ func (s *InboundService) AddInbound(inbound *model.Inbound) (*model.Inbound, boo
|
||||
return inbound, false, err
|
||||
}
|
||||
|
||||
// Legacy import: an inbound exported from a build that predated the hosts
|
||||
// table carries its external proxies inline in streamSettings.externalProxy.
|
||||
// The startup migration that converts those to host rows runs once and is
|
||||
// gated off afterwards, so it never sees a freshly imported inbound —
|
||||
// reproduce it here. No-op for inbounds without externalProxy (everything the
|
||||
// current UI builds), so this only fires on such imports.
|
||||
if _, err = database.CreateHostsFromExternalProxy(tx, inbound.Id, inbound.StreamSettings); err != nil {
|
||||
return inbound, false, err
|
||||
}
|
||||
|
||||
// Before the deferred commit, so a node in "selected" sync mode cannot
|
||||
// sweep the new central row in the gap before its tag is allowed.
|
||||
if inbound.NodeID != nil {
|
||||
|
||||
Reference in New Issue
Block a user