From 5845f318361d0ee4abb4b1b4ff3be6112bfc3776 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Wed, 16 Jun 2021 11:56:44 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20`disable=5Fmail=5Fsending`=20?= =?UTF-8?q?config=20parameter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This disable the ability to send mail through the server. Users need to use their own mail client. --- CHANGELOG | 1 + lib/Lufi.pm | 2 +- lib/Lufi/DefaultConfig.pm | 1 + lufi.conf.template | 4 ++++ themes/default/templates/mail.html.ep | 4 +++- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1bbaec7..ac69085 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ Revision history for Lufi ?.??.? ????-??-?? - 🔧 Set default morbo port to 3000 (as it should have stay) - 🐛 Fix `Notification not defined` in Duckduckgo browser (Fix #224 again) + - ✨ Add `disable_mail_sending` config parameter 0.05.13 2021-01-28 - 🐛 Fix latest git tag improperly fetched diff --git a/lib/Lufi.pm b/lib/Lufi.pm index 10f8206..a480979 100644 --- a/lib/Lufi.pm +++ b/lib/Lufi.pm @@ -232,7 +232,7 @@ sub startup { # Submit mail $r->post('/m') - ->to('Mail#send_mail'); + ->to('Mail#send_mail') unless $self->config('disable_mail_sending'); # Upload files websocket $r->websocket('/upload') diff --git a/lib/Lufi/DefaultConfig.pm b/lib/Lufi/DefaultConfig.pm index 7385778..e1ea0ac 100644 --- a/lib/Lufi/DefaultConfig.pm +++ b/lib/Lufi/DefaultConfig.pm @@ -17,6 +17,7 @@ our $default_config = { how => 'sendmail' }, mail_sender => 'no-reply@lufi.io', + disable_mail_sending => 0, theme => 'default', upload_dir => 'files', session_duration => 3600, diff --git a/lufi.conf.template b/lufi.conf.template index ed2f388..b7401b4 100644 --- a/lufi.conf.template +++ b/lufi.conf.template @@ -166,6 +166,10 @@ # optional, default to no-reply@lufi.io #mail_sender => 'no-reply@lufi.io', + # Disable sending mail through the server + # optional, default is false + #disable_mail_sending => 0, + ############# # DB settings ############# diff --git a/themes/default/templates/mail.html.ep b/themes/default/templates/mail.html.ep index 4d47684..b8ef5d5 100644 --- a/themes/default/templates/mail.html.ep +++ b/themes/default/templates/mail.html.ep @@ -43,7 +43,9 @@ % } - + % if (!$self->config('disable_mail_sending')) { + + % } <%= l('Send with your own mail software') %>