diff --git a/configs/main.js.example b/configs/main.js.example index 4d4d7a09..ad15bb9c 100644 --- a/configs/main.js.example +++ b/configs/main.js.example @@ -39,7 +39,8 @@ module.exports = { min: 3, max: 5 }, - paintAmount: 2 + paintAmount: 2, + fontPaths: [], //optional list of file paths to fonts for captchas }, /* dnsbl, will add a small delay for uncached requests. You could also install some @@ -64,6 +65,10 @@ module.exports = { its not recommended to change this setting after initial setup */ ipHashMode: 1, + /* delete files immediately rather than pruning later. usually disabled to prevent re-thumbnailing and processing commonly + uploaded files, but deleting immediately is better if you are concerned about "deleted" content not being immediately removed */ + pruneImmediately: false, + //cache templates in memory. disable only if editing templates and doing dev work cacheTemplates: true, @@ -126,10 +131,6 @@ module.exports = { regex=custom regex of what to replace e.g. /[^\w\s-]+/g */ filterFileNames: false, - /* delete files immediately rather than pruning later. usually disabled to prevent re-thumbnailing and processing commonly - uploaded files, but deleting immediately is better if you are concerned about "deleted" content not being immediately removed */ - pruneImmediately: false, - //options for code block highlighting in posts highlightOptions: { @@ -262,6 +263,6 @@ module.exports = { audio: true, other: false } - } + }, -} +}; diff --git a/helpers/captcha/captchagenerate.js b/helpers/captcha/captchagenerate.js index 4d7ce76d..d726d28c 100644 --- a/helpers/captcha/captchagenerate.js +++ b/helpers/captcha/captchagenerate.js @@ -53,6 +53,9 @@ module.exports = async () => { const captcha = gm(width,height,'#ffffff') .fill('#000000') .fontSize(65); + if (captchaOptions.fontPaths && captchaOptions.fontPaths.length > 0) { + captcha.font(captchaOptions.fontPaths[Math.floor(Math.random() * captchaOptions.fontPaths.length)]); + } const startX = (width-totalWidth(text))/2; let charX = startX; for (let i = 0; i < 6; i++) {