From 007f775f8b75593127cfbd0588db5c4af1c750a6 Mon Sep 17 00:00:00 2001 From: Cameron Redmore Date: Sat, 15 Feb 2025 13:18:57 +0000 Subject: [PATCH] Add override for discord bot to send image file directly. --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 1fac2fe..b7a9ca4 100644 --- a/index.js +++ b/index.js @@ -126,6 +126,10 @@ fastify.get('/s/:date/:filename', async (request, reply) => { \n`; if (mimeType.startsWith('image/')) { + //If the user agent is DiscordBot, return the image directly + if (request.headers['user-agent'].includes('Discordbot')) { + return reply.redirect(`/f/${joinedPath}`); + } fileContent = `${filename}` ogTags += `