From f9fb1781895aa8fb23072402675c5323cbbb4585 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 18 Nov 2020 11:59:35 +0100 Subject: [PATCH] add 'quarantinelink' to spamquar config to enable the 'Request Quarantine Link' button and api call Signed-off-by: Dominik Csapak --- src/PMG/Config.pm | 6 ++++++ src/PMG/Service/pmgproxy.pm | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm index cd69c9c..155990b 100755 --- a/src/PMG/Config.pm +++ b/src/PMG/Config.pm @@ -289,6 +289,11 @@ sub properties { description => "Text for 'From' header in daily spam report mails.", type => 'string', }, + quarantinelink => { + description => "Enables user self-service for Quarantine Links. Caution: this is accessible without authentication", + type => 'boolean', + default => 0, + }, }; } @@ -303,6 +308,7 @@ sub options { allowhrefs => { optional => 1 }, port => { optional => 1 }, protocol => { optional => 1 }, + quarantinelink => { optional => 1 }, }; } diff --git a/src/PMG/Service/pmgproxy.pm b/src/PMG/Service/pmgproxy.pm index ea58b50..cec2754 100755 --- a/src/PMG/Service/pmgproxy.pm +++ b/src/PMG/Service/pmgproxy.pm @@ -21,6 +21,7 @@ use PVE::APIServer::Utils; use PMG::HTTPServer; use PMG::API2; +use PMG::Config; use Template; @@ -227,6 +228,8 @@ sub get_index { $version = $1; }; + my $cfg = PMG::Config->new(); + my $quarantinelink = $cfg->get('spamquar', 'quarantinelink'); $username = '' if !$username; @@ -242,6 +245,7 @@ sub get_index { debug => $args->{debug} || $server->{debug}, version => $version, wtversion => $wtversion, + quarantinelink => $quarantinelink, }; my $template_name; -- 2.39.2