Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormhsanaei <ho3ein.sanaei@gmail.com>2025-09-23 12:52:40 +0300
committermhsanaei <ho3ein.sanaei@gmail.com>2025-09-23 12:52:40 +0300
commit26c6438ec2b32529ffb85454b60f7b996fec7692 (patch)
tree828bdd36e30a4d33c9fc81b47d8ad71d4ef9ae75 /web/service
parentb3e96230c4556656df92c85e6a68f741a0e1470f (diff)
fix api : subid, uuid from inbound settings
Diffstat (limited to 'web/service')
-rw-r--r--web/service/inbound.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go
index 49916b52..448e6832 100644
--- a/web/service/inbound.go
+++ b/web/service/inbound.go
@@ -35,6 +35,25 @@ func (s *InboundService) GetInbounds(userId int) ([]*model.Inbound, error) {
if err != nil && err != gorm.ErrRecordNotFound {
return nil, err
}
+ // Enrich client stats with UUID/SubId from inbound settings
+ for _, inbound := range inbounds {
+ clients, _ := s.GetClients(inbound)
+ if len(clients) == 0 || len(inbound.ClientStats) == 0 {
+ continue
+ }
+ // Build a map email -> client
+ cMap := make(map[string]model.Client, len(clients))
+ for _, c := range clients {
+ cMap[strings.ToLower(c.Email)] = c
+ }
+ for i := range inbound.ClientStats {
+ email := strings.ToLower(inbound.ClientStats[i].Email)
+ if c, ok := cMap[email]; ok {
+ inbound.ClientStats[i].UUID = c.ID
+ inbound.ClientStats[i].SubId = c.SubID
+ }
+ }
+ }
return inbounds, nil
}
@@ -47,6 +66,24 @@ func (s *InboundService) GetAllInbounds() ([]*model.Inbound, error) {
if err != nil && err != gorm.ErrRecordNotFound {
return nil, err
}
+ // Enrich client stats with UUID/SubId from inbound settings
+ for _, inbound := range inbounds {
+ clients, _ := s.GetClients(inbound)
+ if len(clients) == 0 || len(inbound.ClientStats) == 0 {
+ continue
+ }
+ cMap := make(map[string]model.Client, len(clients))
+ for _, c := range clients {
+ cMap[strings.ToLower(c.Email)] = c
+ }
+ for i := range inbound.ClientStats {
+ email := strings.ToLower(inbound.ClientStats[i].Email)
+ if c, ok := cMap[email]; ok {
+ inbound.ClientStats[i].UUID = c.ID
+ inbound.ClientStats[i].SubId = c.SubID
+ }
+ }
+ }
return inbounds, nil
}