From b02d3746e1585b9cd2ce176e3e475eadf6eaa293 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 21 Mar 2011 14:19:21 -0400 Subject: aggregate: Read cookies from ~/.ikiwiki/cookies by default. Also, the cookiejar configuration setting can be used by other plugins to provide a custom `cookie_jar` object for LWP::UserAgent. (Thanks, schmonz) --- IkiWiki/Plugin/aggregate.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 419b40fdb..5e9673560 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -57,12 +57,21 @@ sub getsetup () { safe => 1, rebuild => 0, }, + cookiejar => { + type => "string", + example => { file => "$ENV{HOME}/.ikiwiki/cookies" }, + safe => 0, # hooks into perl module internals + description => "cookie control", + }, } sub checkconfig () { if (! defined $config{aggregateinternal}) { $config{aggregateinternal}=1; } + if (! defined $config{cookies}) { + $config{cookies}={ file => "$ENV{HOME}/.ikiwiki/cookies" }; + } if ($config{aggregate} && ! ($config{post_commit} && IkiWiki::commit_hook_enabled())) { @@ -510,7 +519,11 @@ sub aggregate (@) { } $feed->{feedurl}=pop @urls; } - my $res=URI::Fetch->fetch($feed->{feedurl}); + my $res=URI::Fetch->fetch($feed->{feedurl}, + UserAgent => LWP::UserAgent->new( + cookie_jar => $config{cookiejar}, + ), + ); if (! $res) { $feed->{message}=URI::Fetch->errstr; $feed->{error}=1; -- cgit v1.2.3