diff --git a/src/routes/api/users/@me.js b/src/routes/api/users/@me.js new file mode 100644 index 0000000..f8fcf24 --- /dev/null +++ b/src/routes/api/users/@me.js @@ -0,0 +1,4 @@ +module.exports.get = fastify => ({ + handler: req => req.user.payload, + onRequest: [fastify.authenticate], +}); \ No newline at end of file diff --git a/src/routes/auth/callback.js b/src/routes/auth/callback.js index 5afa6b1..43cf2cc 100644 --- a/src/routes/auth/callback.js +++ b/src/routes/auth/callback.js @@ -8,7 +8,7 @@ module.exports.get = () => ({ } = await this.discord.getAccessTokenFromAuthorizationCodeFlow(req); const user = await (await fetch('https://discordapp.com/api/users/@me', { headers: { 'Authorization': `Bearer ${access_token}` } })).json(); const payload = { - avatar: `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png`, + avatar: `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.webp`, discriminator: user.discriminator, expiresAt: Date.now() + (expires_in * 1000), id: user.id,