improved base57 decode and tests

This commit is contained in:
2021-10-16 03:40:49 +02:00
parent 99ec0ad1bc
commit 867e85b007
4 changed files with 57 additions and 26 deletions

View File

@@ -155,7 +155,7 @@ type PlayerResponse struct {
Name string `json:"name"`
Avatar string `json:"avatar"`
VAC bool `json:"vac"`
VACDate *time.Time `json:"vac_date,omitempty"`
VACDate *time.Time `json:"vac_date,omitempty"`
Tracked bool `json:"tracked"`
VanityURL string `json:"vanity_url,omitempty"`
MatchStats MatchStats `json:"match_stats,omitempty"`
@@ -188,11 +188,10 @@ type MatchResponse struct {
}
const (
steamID64Entry = "https://steamcommunity.com/profiles/%d?xml=1"
steamVanityURLEntry = "https://steamcommunity.com/id/%s?xml=1"
shareCodeURLEntry = "https://api.steampowered.com/ICSGOPlayers_730/GetNextMatchSharingCode/v1?key=%s&steamid=%d&steamidkey=%s&knowncode=%s"
shareCodeURLEntry = "https://api.steampowered.com/ICSGOPlayers_730/GetNextMatchSharingCode/v1?key=%s&steamid=%d&steamidkey=%s&knowncode=%s"
)
//goland:noinspection SpellCheckingInspection
var (
SteamId64RegEx = regexp.MustCompile(`^\d{17}$`)
ShareCodeRegEx = regexp.MustCompile(`^CSGO(?:-?[ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789]{5}){5}$`)
@@ -213,7 +212,7 @@ func SendJSON(data interface{}, w http.ResponseWriter) error {
return nil
}
func GetMatchStats(db *ent.Client, lock *sync.RWMutex, dbPlayer *ent.Player) (int, int, int, error) {
func GetMatchStats(dbPlayer *ent.Player, lock *sync.RWMutex) (int, int, int, error) {
var res []struct {
MatchResult int `json:"match_result"`
Count int `json:"count"`