From 2c541448a20be7c0b039a559d87c333382ac12d5 Mon Sep 17 00:00:00 2001 From: Kethsar Date: Sat, 25 Mar 2023 01:18:05 -0700 Subject: [PATCH] Set the cap for max-chat-message-length to 1000 --- config.template.yaml | 2 +- src/config.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config.template.yaml b/config.template.yaml index 03c307fa..3652ddd4 100644 --- a/config.template.yaml +++ b/config.template.yaml @@ -128,7 +128,7 @@ max-channels-per-user: 5 max-accounts-per-ip: 5 # Minimum number of seconds between guest logins from the same IP guest-login-delay: 60 -# Maximum character length of a chat message +# Maximum character length of a chat message, capped at 1000 characters max-chat-message-length: 320 # Allows you to customize the path divider. The /r/ in http://localhost/r/yourchannel diff --git a/src/config.js b/src/config.js index 1fe888d0..dd6b32aa 100644 --- a/src/config.js +++ b/src/config.js @@ -428,6 +428,11 @@ function preprocessConfig(cfg) { cfg['channel-storage'] = { type: undefined }; } + if (cfg["max-chat-message-length"] > 1000) { + LOGGER.warn("Max chat message length was greater than 1000. Setting to 1000."); + cfg["max-chat-message-length"] = 1000; + } + return cfg; }