From bc06dbab21df01ede095d850a41ac769ae582469 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Tue, 25 Apr 2023 18:36:06 +0330 Subject: [migration] add fix for omitted traffics Co-Authored-By: Alireza Ahmadi --- web/service/inbound.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'web/service') diff --git a/web/service/inbound.go b/web/service/inbound.go index 0245ffa7..ab2ceb66 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -868,6 +868,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) } -- cgit v1.2.3