server icon indicating copy to clipboard operation
server copied to clipboard

Adjusting avatar routes to work with the new format

Open atvalerie opened this issue 5 months ago • 2 comments

as of recently, you can see 6 of your most recent avatars when changing your current one (assuming you have nitro)

the route is GET /api/v9/users/@me/avatars and follows this format:

{
    "avatars": [
        {
            "id": "1386423687284265200",
            "storage_hash": "(avatar storage hash)",
            "description": "(uuid), added 22 June 2025 at 21:12"
        },
        {
            "id": "12341234123412341234",
            "storage_hash": "(avatar storage hash)",
            "description": "Avatar, added 17 May 2025 at 11:56"
        },
        {
            "id": "12341234123412341234",
            "storage_hash": "(avatar storage hash)",
            "description": "\uc544\ubc14\ud0c0, 2025\ub144 3\uc6d4 24\uc77c \uc624\uc804 3:37" // "Avatar, March 24, 2025 at 3:37 AM" in Korean
        },
        {
            "id": "1234123412341234123",
            "storage_hash": "(avatar storage hash)",
            "description": null
        }
    ]
}

when uploading a new avatar, a PATCH /api/v9/users/@me is sent, with data:

{
    "avatar": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAL8...",
    "avatar_description": "file_(uuid).(some long string).1.thumbnail-256, added July 17, 2025 at 4:28 AM"
}

that means that when a discord compatible client which supports the new format tries to upload an avatar to a spacebar server, they are met with an error:

{
  "code": 50035,
  "message": "Invalid Form Body",
  "errors": {
    "": {
      "_errors": [
        {
          "message": "must NOT have additional properties",
          "code": "additionalProperties"
        }
      ]
    }
  }
}

since the client sends the description property.

the avatar column in the users table contains the hash for only one avatar, so if support for the new format was added, it would either need a new table (for avatar id, storage hash and description), or a different way of storing that data in that column.

atvalerie avatar Jul 17 '25 02:07 atvalerie

According to https://docs.discord.food/resources/user#get-recent-avatars - premium users can see 6 avatars, and normal users up to 2.

atvalerie avatar Jul 17 '25 03:07 atvalerie

premium users can see 6 avatars, and normal users up to 2.

It was supposed to be that way at first, but they've changed it to be 6 for everyone

Image

CyberL1 avatar Jul 17 '25 05:07 CyberL1