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
path: root/web
diff options
context:
space:
mode:
authorAli Golzar <agt.ali.gr@gmail.com>2025-09-02 01:57:44 +0300
committerAli Golzar <57574919+aliglzr@users.noreply.github.com>2025-09-02 13:00:41 +0300
commited2a0a0bcf99d1636b8ae7c1689d348d78b334c1 (patch)
tree5f502dfe8e298d4d4b3ae2bb185188e497317d57 /web
parent4a0914cb1e271ab4f076cb1bd68c9f07cc025e92 (diff)
fix: prevent client `updated_at` from resetting when parent inbound is updated
Diffstat (limited to 'web')
-rw-r--r--web/service/inbound.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go
index b494d502..a4592160 100644
--- a/web/service/inbound.go
+++ b/web/service/inbound.go
@@ -349,6 +349,7 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
var oldSettings map[string]any
_ = json.Unmarshal([]byte(oldInbound.Settings), &oldSettings)
emailToCreated := map[string]int64{}
+ emailToUpdated := map[string]int64{}
if oldSettings != nil {
if oc, ok := oldSettings["clients"].([]any); ok {
for _, it := range oc {
@@ -360,6 +361,12 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
case int64:
emailToCreated[email] = v
}
+ switch v := m["updated_at"].(type) {
+ case float64:
+ emailToUpdated[email] = int64(v)
+ case int64:
+ emailToUpdated[email] = v
+ }
}
}
}
@@ -379,7 +386,12 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
m["created_at"] = now
}
}
- m["updated_at"] = now
+ // Preserve client's updated_at if present; do not bump on parent inbound update
+ if _, hasUpdated := m["updated_at"]; !hasUpdated {
+ if v, ok4 := emailToUpdated[email]; ok4 && v > 0 {
+ m["updated_at"] = v
+ }
+ }
nSlice[i] = m
}
}