From a4cc90817a4613654d0e477749c27b3d3cfcdb84 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Mon, 12 Feb 2018 16:01:00 +0100 Subject: Fetch admin email from API if we have logged in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- bin/generate-mirror-mail.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bin/generate-mirror-mail.pl') diff --git a/bin/generate-mirror-mail.pl b/bin/generate-mirror-mail.pl index 302de25..f6efc44 100755 --- a/bin/generate-mirror-mail.pl +++ b/bin/generate-mirror-mail.pl @@ -1,7 +1,9 @@ #!/usr/bin/perl use warnings; use strict; +use File::Basename; use JSON; +use HTTP::Cookies; use WWW::Mechanize; use Date::Parse; use Date::Format; @@ -64,7 +66,8 @@ Florian }, ); -my $mech = WWW::Mechanize->new(cookie_jar => {}); +my $cookie_jar = HTTP::Cookies->new(file => dirname($0) . "/../cookie_jar", autosave => 1); +my $mech = WWW::Mechanize->new(cookie_jar => $cookie_jar); sub send_mail { my $to = shift; @@ -136,8 +139,7 @@ while () { my @last_sync = keys %{{ map { ${$_}{time} => 1 } @out_of_sync }}; my $sent_mail = 0; - # TODO: set $to - my $to = ''; + my $to = $json->{admin_email}; if (@out_of_sync) { my %values = ( -- cgit v1.2.3-24-g4f1b