From 25f68eb23dd53083e84608e2b1af2109d6a260ac Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 22 Jul 2024 10:43:21 +0200 Subject: Allow failing modules if they miss data files --- modules/email/email.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'modules/email') diff --git a/modules/email/email.js b/modules/email/email.js index e4d342b..d7fe171 100644 --- a/modules/email/email.js +++ b/modules/email/email.js @@ -41,10 +41,16 @@ function sendEmail(recip, text) { } module.exports = function(app, io, moddir) { - var allowedRecipients = - fs.readFileSync(moddir + "/allowed_recipients.txt").toString().trim().split("\n"); + var allowedRecipients, password; - var password = fs.readFileSync(moddir + "/password.txt").toString().trim(); + try { + allowedRecipients = + fs.readFileSync(moddir + "/allowed_recipients.txt").toString().trim().split("\n"); + password = fs.readFileSync(moddir + "/password.txt").toString().trim(); + } catch (e) { + console.error(e); + return false; + } app.post("/email", bodyParser.json(), function(req, res) { var body = req.body; -- cgit v1.2.3-70-g09d2