fix(nordvpn): remove commas from region values

This commit is contained in:
Quentin McGaw
2024-08-19 03:08:14 +00:00
parent 7064a44403
commit d166314f8b
3 changed files with 173 additions and 169 deletions

View File

@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/netip"
"strings"
)
// Check out the JSON data from https://api.nordvpn.com/v2/servers?limit=10
@@ -92,6 +93,9 @@ func (s serversData) idToData() (
) {
groups = make(map[uint32]groupData, len(s.Groups))
for _, group := range s.Groups {
if group.Type.Identifier == "regions" { //nolint:goconst
group.Title = strings.ReplaceAll(group.Title, ",", "")
}
groups[group.ID] = group
}

View File

@@ -79,7 +79,7 @@ func extractServers(jsonServer serverData, groups map[uint32]groupData,
server := models.Server{
Country: location.Country.Name,
Region: jsonServer.region(groups),
Region: region,
City: location.Country.City.Name,
Categories: jsonServer.categories(groups),
Hostname: jsonServer.Hostname,

File diff suppressed because it is too large Load Diff