From 82b6bc8cfdd3ced1f1d5581834ecb6d2f8808037 Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 22 Nov 2024 21:43:16 +0000 Subject: [PATCH] Attempt to use simpler avatar url property. --- services/auth/source/oauth2/flashii/flashii.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/services/auth/source/oauth2/flashii/flashii.go b/services/auth/source/oauth2/flashii/flashii.go index 03ed6bdf38..4a5c4d827a 100644 --- a/services/auth/source/oauth2/flashii/flashii.go +++ b/services/auth/source/oauth2/flashii/flashii.go @@ -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 }