From 8bc16b020b68139ff88954fcc4b169d92f3ee414 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Tue, 25 Apr 2023 16:22:42 +0200 Subject: [PATCH] [migration] add fix for omitted traffics --- web/service/inbound.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/web/service/inbound.go b/web/service/inbound.go index c8657762..2d0adb86 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -807,6 +807,19 @@ func (s *InboundService) MigrationRequirements() { inbounds[inbound_index].Settings = string(modifiedSettings) } + modelClients, err := s.getClients(inbounds[inbound_index]) + if err != nil { + return + } + for _, modelClient := range modelClients { + if len(modelClient.Email) > 0 { + var count int64 + db.Model(xray.ClientTraffic{}).Where("email = ?", modelClient.Email).Count(&count) + if count == 0 { + s.AddClientStat(inbounds[inbound_index].Id, &modelClient) + } + } + } } db.Save(inbounds) }