]> git.proxmox.com Git - pmg-api.git/commitdiff
add 'quarantinelink' to spamquar config
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 18 Nov 2020 10:59:35 +0000 (11:59 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 18 Nov 2020 16:04:38 +0000 (17:04 +0100)
to enable the 'Request Quarantine Link' button and api call

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PMG/Config.pm
src/PMG/Service/pmgproxy.pm

index cd69c9cdbfff5eb8160b4d0b3591dcec910082c8..155990b992dfebda65b52d3a2b9e096d1551db1a 100755 (executable)
@@ -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 },
     };
 }
 
index ea58b5082182ff679ee8e83902f4a01a975d16be..cec2754aa27ffc25fa462cbd35468d5dccef246f 100755 (executable)
@@ -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;