RiiConnect24 / RiiTag-Next

A customizable Gamertag for Wii, Wii U and more! Now powered by Next.js.
https://tag.rc24.xyz
GNU Affero General Public License v3.0
15 stars 14 forks source link

Disable Discord Avatar Cache #32

Closed bendevnull closed 1 year ago

bendevnull commented 1 year ago

Disables caching Discord avatars to allow them to update when changes are made on Discord. If another resourceful method is thought of, please feel free to change that here.

Brawl345 commented 1 year ago

Keep in mind that the avatar URL in the database is only updated on a fresh login. I think if you change your discord avatar the URL to it changes, too so it will keep re-fetching the old avatar? I'm not sure though.

bendevnull commented 1 year ago

I don't think so? I'm pretty sure it fetches by the user ID

Brawl345 commented 1 year ago

The URL is returned by Discord when authenticating: https://github.com/WiiDatabase/RiiTag-Next/blob/c09d3f167ac5b9590614ce152d4865a154750690/src/pages/api/auth/login/discord.js#L65-L73 the user ID is only a part of it.

According to the docu: https://discord.com/developers/docs/reference#image-formatting

Discord uses ids and hashes to render images in the client. These hashes can be retrieved through various API requests, like [Get User](https://discord.com/developers/docs/resources/user#get-user)