htmllink readfile writefile pagetype srcfile pagename
displaytime strftime_utf8 will_render gettext ngettext urlto targetpage
add_underlay pagetitle titlepage linkpage newpagefile
- inject add_link add_autofile
+ inject add_link add_autofile useragent
%config %links %pagestate %wikistate %renderedfiles
%pagesources %destsources %typedlinks);
our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
safe => 0,
rebuild => 0,
},
+ cookiejar => {
+ type => "string",
+ default => { file => "$ENV{HOME}/.ikiwiki/cookies" },
+ description => "cookie control",
+ safe => 0, # hooks into perl module internals
+ rebuild => 0,
+ },
}
sub defaultconfig () {
$autofiles{$file}{generator}=$generator;
}
+sub useragent () {
+ return LWP::UserAgent->new(
+ cookie_jar => $config{cookiejar},
+ env_proxy => 1, # respect proxy env vars
+ );
+}
+
sub sortspec_translate ($$) {
my $spec = shift;
my $reverse = shift;
my $user=shift;
my %params=@_;
- my $regexp=IkiWiki::glob2re($user);
-
if (! exists $params{user}) {
return IkiWiki::ErrorReason->new("no user specified");
}
+ my $regexp=IkiWiki::glob2re($user);
+
if (defined $params{user} && $params{user}=~$regexp) {
return IkiWiki::SuccessReason->new("user is $user");
}
if (! exists $params{ip}) {
return IkiWiki::ErrorReason->new("no IP specified");
}
+
+ my $regexp=IkiWiki::glob2re(lc $ip);
- if (defined $params{ip} && lc $params{ip} eq lc $ip) {
+ if (defined $params{ip} && lc $params{ip}=~$regexp) {
return IkiWiki::SuccessReason->new("IP is $ip");
}
else {