fix(xray): emit an empty client array instead of null in the generated config (#6117)

finalClients was a nil slice, so an inbound that has a clients key but whose
clients are all filtered out — disabled by an admin, or cut by the traffic
job for quota or expiry — was handed to xray-core as "clients": null.

The panel already treats a stored null client list as invalid data and
coerces it to [] at startup, and null is what reporters see in bin/config.json
when they go looking for a connectivity problem, which sends the diagnosis
after a serialization bug that is not there. Build the slice empty so the
same state serializes as [].

The reported inbound also needs the clients table to be in sync, which is a
separate question still open on the issue.
This commit is contained in:
Sanaei
2026-07-27 14:34:09 +02:00
parent 0e69f64e56
commit 6f4cc1e53c
2 changed files with 118 additions and 1 deletions
+1 -1
View File
@@ -156,7 +156,7 @@ func (s *XrayService) GetXrayConfig() (*xray.Config, error) {
enableMap[clientTraffic.Email] = clientTraffic.Enable
}
var finalClients []any
finalClients := make([]any, 0, len(dbClients))
var wgPeers []any
for i := range dbClients {
c := dbClients[i]