This commit is contained in:
+6
-3
@@ -653,12 +653,13 @@ authRoutes.get('/me', authRequired, (c) => {
|
||||
authRoutes.get('/profile/avatar', authRequired, async (c) => {
|
||||
const image = await findUserProfileImage(c.get('user').id)
|
||||
if (!image) return c.body(null, 404)
|
||||
if (image.url) return c.redirect(image.url, 302)
|
||||
|
||||
c.header('content-type', image.mimeType)
|
||||
c.header('cache-control', 'no-store')
|
||||
if (image.updatedAt) c.header('last-modified', image.updatedAt.toUTCString())
|
||||
|
||||
return c.body(new Uint8Array(image.data))
|
||||
return c.body(new Uint8Array(image.data!))
|
||||
})
|
||||
|
||||
authRoutes.get('/users/:userId/avatar', authRequired, async (c) => {
|
||||
@@ -667,12 +668,13 @@ authRoutes.get('/users/:userId/avatar', authRequired, async (c) => {
|
||||
const userId = c.req.param('userId')
|
||||
const image = await findUserProfileImage(userId)
|
||||
if (!image) return c.body(null, 404)
|
||||
if (image.url) return c.redirect(image.url, 302)
|
||||
|
||||
c.header('content-type', image.mimeType)
|
||||
c.header('cache-control', 'no-store')
|
||||
if (image.updatedAt) c.header('last-modified', image.updatedAt.toUTCString())
|
||||
|
||||
return c.body(new Uint8Array(image.data))
|
||||
return c.body(new Uint8Array(image.data!))
|
||||
})
|
||||
|
||||
authRoutes.get('/users/avatar', authRequired, async (c) => {
|
||||
@@ -686,12 +688,13 @@ authRoutes.get('/users/avatar', authRequired, async (c) => {
|
||||
|
||||
const image = await findUserProfileImage(user.id)
|
||||
if (!image) return c.body(null, 404)
|
||||
if (image.url) return c.redirect(image.url, 302)
|
||||
|
||||
c.header('content-type', image.mimeType)
|
||||
c.header('cache-control', 'no-store')
|
||||
if (image.updatedAt) c.header('last-modified', image.updatedAt.toUTCString())
|
||||
|
||||
return c.body(new Uint8Array(image.data))
|
||||
return c.body(new Uint8Array(image.data!))
|
||||
})
|
||||
|
||||
authRoutes.put('/profile/avatar', authRequired, async (c) => {
|
||||
|
||||
Reference in New Issue
Block a user