mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-25 13:56:10 +00:00
fix(hosts): assign group ids to imported hosts and repair empty ones
Host rows created from a legacy streamSettings.externalProxy during inbound import got an empty group_id, and the one-time HostGroupIds seeder had already been gated off, so the UI rendered them under a synthetic fallback_<id> group the update/delete API could not resolve, failing every edit with "host group not found". Assign a real group id in externalProxyEntryToHost at creation, and replace the seeder with backfillEmptyHostGroupIds, an idempotent startup repair that runs on every boot so rows from older builds and restored backups are healed too. Also rename the leaked internal error "host group not found" to "host not found" since groups are not a user-facing concept.
This commit is contained in:
@@ -213,11 +213,11 @@ func (s *HostService) GetHostGroup(groupId string) (*entity.HostGroup, error) {
|
||||
return nil, err
|
||||
}
|
||||
if len(hosts) == 0 {
|
||||
return nil, common.NewError("host group not found")
|
||||
return nil, common.NewError("host not found")
|
||||
}
|
||||
grouped := groupHosts(hosts)
|
||||
if len(grouped) == 0 {
|
||||
return nil, common.NewError("host group not found")
|
||||
return nil, common.NewError("host not found")
|
||||
}
|
||||
return grouped[0], nil
|
||||
}
|
||||
@@ -253,7 +253,7 @@ func (s *HostService) UpdateHostGroup(groupId string, req *entity.HostGroup) ([]
|
||||
return err
|
||||
}
|
||||
if count == 0 {
|
||||
return common.NewError("host group not found")
|
||||
return common.NewError("host not found")
|
||||
}
|
||||
if err := validateInboundsExist(tx, req.InboundIds); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user