Attempt to use simpler avatar url property.

This commit is contained in:
flash 2024-11-22 21:43:16 +00:00
parent 1e8940c65d
commit 82b6bc8cfd

View file

@ -125,17 +125,12 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
}
func userFromReader(reader io.Reader, user *goth.User) error {
type FlashiiUserAvatarRes struct {
Resolution int32 `json:"res"`
URL string `json:"url"`
}
u := struct {
Id string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Title string `json:"title"`
AvatarURLs []FlashiiUserAvatarRes `json:"avatar_urls"`
Id string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Title string `json:"title"`
AvatarURL string `json:"avatar_url"`
}{}
err := json.NewDecoder(reader).Decode(&u)
@ -147,7 +142,7 @@ func userFromReader(reader io.Reader, user *goth.User) error {
user.NickName = u.Name
user.Email = u.Email
user.Description = u.Title
user.AvatarURL = u.AvatarURLs[0].URL
user.AvatarURL = u.AvatarURL
return err
}