From 7118d92980ebb60ea65e30008d6a4be9423d414a Mon Sep 17 00:00:00 2001 From: somebodywashere <68244480+somebodywashere@users.noreply.github.com> Date: Fri, 5 Apr 2024 12:24:18 +0300 Subject: [PATCH] Convert string tgId to int64 on Migrate --- web/service/inbound.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/service/inbound.go b/web/service/inbound.go index adfa0fb4..95962041 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -3,6 +3,7 @@ package service import ( "encoding/json" "fmt" + "strconv" "strings" "time" @@ -1838,6 +1839,17 @@ func (s *InboundService) MigrationRequirements() { c["email"] = "" } + // Convert string tgId to int64 + if _, ok := c["tgId"]; ok { + var tgId interface{} = c["tgId"] + if tgIdStr, ok2 := tgId.(string); ok2 { + tgIdInt64, err := strconv.ParseInt(strings.ReplaceAll(tgIdStr, " ", ""), 10, 64) + if err == nil { + c["tgId"] = tgIdInt64 + } + } + } + // Remove "flow": "xtls-rprx-direct" if _, ok := c["flow"]; ok { if c["flow"] == "xtls-rprx-direct" {