From 8a77bf18491c2ec252677e562ef7522755027816 Mon Sep 17 00:00:00 2001 From: Dragory Date: Sun, 18 Feb 2018 20:06:24 +0200 Subject: [PATCH] Disable small attachment relaying by default, add option for it --- src/config.js | 2 ++ src/data/Thread.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/config.js b/src/config.js index d2fba6b..d4d8b95 100644 --- a/src/config.js +++ b/src/config.js @@ -32,6 +32,8 @@ const defaultConfig = { "greetingMessage": null, "greetingAttachment": null, + "relaySmallAttachmentsAsAttachments": false, + "port": 8890, "url": null, diff --git a/src/data/Thread.js b/src/data/Thread.js index a0feaa4..0240567 100644 --- a/src/data/Thread.js +++ b/src/data/Thread.js @@ -108,11 +108,11 @@ class Thread { const formatted = '\n\n' + await utils.formatAttachment(attachment); logContent += formatted; // Logs always contain the link - if (attachment.size > 1024 * 1024 * 2) { - threadContent += formatted; - } else { + if (config.relaySmallAttachmentsAsAttachments && attachment.size <= 1024 * 1024 * 2) { const file = await attachments.attachmentToFile(attachment); attachmentFiles.push(file); + } else { + threadContent += formatted; } }