feat: not caching for fallback image

This commit is contained in:
원더 2021-02-12 11:25:59 +09:00
parent fdef8c1eaf
commit 22a600a1e5

View File

@ -16,6 +16,7 @@ const Avatar = nc<ApiRequest, NextApiResponse>()
const ratelimited = RateLimitHandler(res, { used: rate, limit: 600, reset: (<any>imageRateLimit).scheduler.get(req.socket.remoteAddress).expiry, onLimitExceed: async(res) => { const ratelimited = RateLimitHandler(res, { used: rate, limit: 600, reset: (<any>imageRateLimit).scheduler.get(req.socket.remoteAddress).expiry, onLimitExceed: async(res) => {
const img = await get.images.user.load(DiscordEnpoints.CDN.default(Math.floor(Math.random() * 6), { format: 'png' })) const img = await get.images.user.load(DiscordEnpoints.CDN.default(Math.floor(Math.random() * 6), { format: 'png' }))
res.setHeader('Content-Type', 'image/png') res.setHeader('Content-Type', 'image/png')
res.setHeader('Cache-Control', 'no-cache')
img.pipe(res) img.pipe(res)
} }) } })
if(ratelimited) return if(ratelimited) return