[PR #6458] [MERGED] fix(inbounds): serve fresh client UUIDs for list and allLinks #6280

Closed
opened 2026-11-02 04:07:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6458
Author: @mrchatam
Created: 9/11/2026
Status: ✅ Merged
Merged: 9/12/2026
Merged by: @MHSanaei

Base: main ← Head: fix/inbound-links-fresh-uuid


📝 Commits (3)

  • 918cd14 fix(inbounds): serve fresh client UUIDs for list and allLinks (#6436)
  • ebac8d8 fix(sub): keep WG/AWG settings identity in link exports (#6436)
  • 1838f40 fix(sub): fall back to settings clients for link export (#6458)

📊 Changes

6 files changed (+325 additions, -12 deletions)

View changed files

📝 internal/sub/export_all_links_test.go (+180 -0)
📝 internal/sub/links_test.go (+38 -0)
📝 internal/sub/service.go (+33 -6)
📝 internal/web/service/inbound.go (+8 -0)
📝 internal/web/service/inbound_clients.go (+9 -6)
➕ internal/web/service/inbound_clients_stale_uuid_test.go (+57 -0)

📄 Description

Summary

Fixes #6436.

/inbounds/list (ClientStats.uuid) and /inbounds/allLinks were reading client identity from the inbound's embedded settings.clients[] JSON. After some client edits that JSON can lag the clients table / running Xray config, so the panel handed out dead UUIDs while subscription links still worked.

This change keeps the write paths alone and only switches those two read paths to the normalized clients table (same source Xray already uses):

  1. SubService.inboundLinks → InboundService.ListClientsForInbound (clientService.ListForInbound)
  2. backfillClientStats / enrichClientStats → clientService.ListForInbound so list enrichment uses the live UUID/SubId

No settings-JSON rewrite/migration job.

Test plan

  • go test ./internal/sub/ -run TestInboundLinks_
  • go test ./internal/web/service/ -run TestEnrichClientStats_UsesClientsTableUUIDWhenSettingsStale
  • On a panel with divergent UUID (settings stale vs clients table): confirm /panel/api/inbounds/list → clientStats[].uuid matches /panel/api/clients/get/{email} and running Xray
  • Confirm /panel/api/inbounds/allLinks embeds the fresh UUID (link works)
  • Confirm /panel/api/clients/subLinks/{subId} unchanged/still works

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6458 **Author:** [@mrchatam](https://github.com/mrchatam) **Created:** 9/11/2026 **Status:** ✅ Merged **Merged:** 9/12/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/inbound-links-fresh-uuid` --- ### 📝 Commits (3) - [`918cd14`](https://github.com/MHSanaei/3x-ui/commit/918cd14d9f7a30b59ca333c50564b79883ba0856) fix(inbounds): serve fresh client UUIDs for list and allLinks (#6436) - [`ebac8d8`](https://github.com/MHSanaei/3x-ui/commit/ebac8d87443a14c953c96aa9ccb5ef092bf0fb6a) fix(sub): keep WG/AWG settings identity in link exports (#6436) - [`1838f40`](https://github.com/MHSanaei/3x-ui/commit/1838f4087d549329ed24fed3b3d9c5a79cc1ff5c) fix(sub): fall back to settings clients for link export (#6458) ### 📊 Changes **6 files changed** (+325 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `internal/sub/export_all_links_test.go` (+180 -0) 📝 `internal/sub/links_test.go` (+38 -0) 📝 `internal/sub/service.go` (+33 -6) 📝 `internal/web/service/inbound.go` (+8 -0) 📝 `internal/web/service/inbound_clients.go` (+9 -6) ➕ `internal/web/service/inbound_clients_stale_uuid_test.go` (+57 -0) </details> ### 📄 Description ## Summary Fixes #6436. `/inbounds/list` (`ClientStats.uuid`) and `/inbounds/allLinks` were reading client identity from the inbound's embedded `settings.clients[]` JSON. After some client edits that JSON can lag the `clients` table / running Xray config, so the panel handed out dead UUIDs while subscription links still worked. This change keeps the write paths alone and only switches those two read paths to the normalized clients table (same source Xray already uses): 1. `SubService.inboundLinks` → `InboundService.ListClientsForInbound` (`clientService.ListForInbound`) 2. `backfillClientStats` / `enrichClientStats` → `clientService.ListForInbound` so list enrichment uses the live UUID/SubId No settings-JSON rewrite/migration job. ## Test plan - [x] `go test ./internal/sub/ -run TestInboundLinks_` - [x] `go test ./internal/web/service/ -run TestEnrichClientStats_UsesClientsTableUUIDWhenSettingsStale` - [ ] On a panel with divergent UUID (settings stale vs clients table): confirm `/panel/api/inbounds/list` → `clientStats[].uuid` matches `/panel/api/clients/get/{email}` and running Xray - [ ] Confirm `/panel/api/inbounds/allLinks` embeds the fresh UUID (link works) - [ ] Confirm `/panel/api/clients/subLinks/{subId}` unchanged/still works --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:07:38 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6280
No description provided.