Skip to content

Commit

Permalink
Convert string tgId to int64 on Migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
somebodywashere committed Apr 5, 2024
1 parent 59708d6 commit 7118d92
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions web/service/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package service
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -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" {
Expand Down

0 comments on commit 7118d92

Please sign in to comment.