Move missing avatar logic from JavaScript to server.

This commit is contained in:
Patrick Fairbank
2019-09-14 14:00:51 -07:00
parent 969f0f1c80
commit b9e061904f
6 changed files with 31 additions and 15 deletions

View File

@@ -20,7 +20,7 @@ import (
const (
tbaBaseUrl = "https://www.thebluealliance.com"
tbaAuthKey = "MAApv9MCuKY9MSFkXLuzTSYBCdosboxDq8Q3ujUE2Mn8PD3Nmv64uczu5Lvy0NQ3"
avatarsDir = "static/img/avatars"
AvatarsDir = "static/img/avatars"
)
type TbaClient struct {
@@ -242,7 +242,7 @@ func (client *TbaClient) DownloadTeamAvatar(teamNumber, year int) error {
}
// Store the avatar to disk as a PNG file.
avatarPath := fmt.Sprintf("%s/%d.png", avatarsDir, teamNumber)
avatarPath := fmt.Sprintf("%s/%d.png", AvatarsDir, teamNumber)
ioutil.WriteFile(avatarPath, avatarBytes, 0644)
return nil
}