From c766c245ec45821997b45bf21e091251b4110d30 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Thu, 10 Oct 2024 16:51:37 +0200 Subject: [PATCH] buh --- src/commands/fun/gelbooru.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index ab2f182..843836a 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -100,11 +100,18 @@ function proxy(url) { if (!process.env.IMGPROXY_HOST) return url; + const auth = {}; + if (process.env.IMGPROXY_SALT && process.env.IMGPROXY_KEY) { + Object.assign(auth, { + salt: process.env.IMGPROXY_SALT, + key: process.env.IMGPROXY_KEY + }) + } + url = generateImageUrl({ endpoint: process.env.IMGPROXY_HOST, url: url, - salt: process.env.IMGPROXY_SALT, - key: process.env.IMGPROXY_KEY + ...auth }); return url; @@ -160,7 +167,7 @@ module.exports = { .setTitle(`Post #${post.id}`) .setURL(post.postView) .setDescription(description) - .setImage(post.fileUrl) + .setImage(proxy(post.fileUrl)) .setFooter({ text: footerText, iconURL: proxy(`https://${post.booru.domain}/favicon.ico`),