From 1640d12102c75d2214ab5117818e90182ba1a9ae Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 24 Jan 2011 16:59:15 -0400 Subject: [PATCH 1/1] blogspam: Don't check modifications from admins for spam, and also allow the blogspam_pagespec to do other matches against who the user is. --- IkiWiki/Plugin/blogspam.pm | 14 ++++++++++---- debian/changelog | 2 ++ doc/plugins/blogspam.mdwn | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm index f0b6cb2a2..d32c2f169 100644 --- a/IkiWiki/Plugin/blogspam.pm +++ b/IkiWiki/Plugin/blogspam.pm @@ -61,12 +61,18 @@ sub checkcontent (@) { my %params=@_; my $session=$params{session}; - if (exists $config{blogspam_pagespec}) { - return undef - if ! pagespec_match($params{page}, $config{blogspam_pagespec}, - location => $params{page}); + my $spec='!admin()'; + if (exists $config{blogspam_pagespec} && + length $config{blogspam_pagespec}) { + $spec.=" and (".$config{blogspam_pagespec}.")"; } + my $user=$session->param("name"); + return undef unless pagespec_match($params{page}, $spec, + (defined $user ? (user => $user) : ()), + (defined $session->remote_addr() ? (ip => $session->remote_addr()) : ()), + location => $params{page}); + my $url=$defaulturl; $url = $config{blogspam_server} if exists $config{blogspam_server}; diff --git a/debian/changelog b/debian/changelog index 94eb507e6..ae2ff779e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ ikiwiki (3.20110124) UNRELEASED; urgency=low * comments: Fix commenting, broken by security fix. + * blogspam: Don't check modifications from admins for spam, and also + allow the blogspam_pagespec to do other matches against who the user is. -- Joey Hess Mon, 24 Jan 2011 16:56:05 -0400 diff --git a/doc/plugins/blogspam.mdwn b/doc/plugins/blogspam.mdwn index a13b6e8f4..c158316d4 100644 --- a/doc/plugins/blogspam.mdwn +++ b/doc/plugins/blogspam.mdwn @@ -23,7 +23,7 @@ you can check whether the interaction with blogspam.net works. The `blogspam_pagespec` setting is a [[ikiwiki/PageSpec]] that can be used to configure which pages are checked for spam. The default is to check all edits. If you only want to check [[comments]] (not wiki page edits), -set it to "postcomment(*)". +set it to "postcomment(*)". Posts by admins are never checked for spam. By default, the blogspam.net server is used to do the spam checking. To change this, the `blogspam_server` option can be set to the url for a -- 2.39.5