[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#775380: wheezy-pu: package ikiwiki/3.20120629.1



Package: release.debian.org
Severity: normal
Tags: wheezy
User: release.debian.org@packages.debian.org
Usertags: pu

Here is the pu request corresponding to #774835, backporting support for
the new blogspam.net API to ikiwiki. This makes ikiwiki/stable able to
filter spammy comments again.

May I upload?

Thanks,
    S
diffstat for ikiwiki-3.20120629 ikiwiki-3.20120629.1

 CHANGELOG                  |   15 +++++++++++++
 IkiWiki/Plugin/blogspam.pm |   49 ++++++++++++++++++++++++++++++++-------------
 debian/changelog           |   15 +++++++++++++
 debian/control             |    2 -
 doc/plugins/blogspam.mdwn  |    2 -
 ikiwiki.spec               |    2 -
 po/ikiwiki.pot             |   10 ++++-----
 7 files changed, 73 insertions(+), 22 deletions(-)

diff -Nru ikiwiki-3.20120629/CHANGELOG ikiwiki-3.20120629.1/CHANGELOG
--- ikiwiki-3.20120629/CHANGELOG	2012-06-29 15:16:29.000000000 +0100
+++ ikiwiki-3.20120629.1/CHANGELOG	2015-01-14 22:14:02.000000000 +0000
@@ -1,3 +1,18 @@
+ikiwiki (3.20120629.1) wheezy; urgency=medium
+
+  Backport blogspam plugin from experimental, because the version in
+  wheezy is no longer unusable:
+
+  [ Joey Hess ]
+  * Set Debian package maintainer to Simon McVittie as I'm retiring from
+    Debian.
+
+  [ Amitai Schlair ]
+  * blogspam: use the 2.0 JSON API (the 1.0 XML-RPC API has been EOL'd).
+    Closes: #774441
+
+ -- Simon McVittie <smcv@debian.org>  Wed, 14 Jan 2015 22:10:48 +0000
+
 ikiwiki (3.20120629) unstable; urgency=low
 
   * mirrorlist: Add mirrorlist_use_cgi setting that avoids usedirs or
diff -Nru ikiwiki-3.20120629/debian/changelog ikiwiki-3.20120629.1/debian/changelog
--- ikiwiki-3.20120629/debian/changelog	2012-06-29 15:16:29.000000000 +0100
+++ ikiwiki-3.20120629.1/debian/changelog	2015-01-14 22:14:02.000000000 +0000
@@ -1,3 +1,18 @@
+ikiwiki (3.20120629.1) wheezy; urgency=medium
+
+  Backport blogspam plugin from experimental, because the version in
+  wheezy is no longer unusable:
+
+  [ Joey Hess ]
+  * Set Debian package maintainer to Simon McVittie as I'm retiring from
+    Debian.
+
+  [ Amitai Schlair ]
+  * blogspam: use the 2.0 JSON API (the 1.0 XML-RPC API has been EOL'd).
+    Closes: #774441
+
+ -- Simon McVittie <smcv@debian.org>  Wed, 14 Jan 2015 22:10:48 +0000
+
 ikiwiki (3.20120629) unstable; urgency=low
 
   * mirrorlist: Add mirrorlist_use_cgi setting that avoids usedirs or
diff -Nru ikiwiki-3.20120629/debian/control ikiwiki-3.20120629.1/debian/control
--- ikiwiki-3.20120629/debian/control	2012-05-17 05:31:16.000000000 +0100
+++ ikiwiki-3.20120629.1/debian/control	2015-01-14 22:06:16.000000000 +0000
@@ -8,7 +8,7 @@
   libhtml-scrubber-perl, wdg-html-validator,
   libhtml-parser-perl, liburi-perl (>= 1.36), perlmagick, po4a (>= 0.34),
   libfile-chdir-perl, libyaml-libyaml-perl, python-support
-Maintainer: Joey Hess <joeyh@debian.org>
+Maintainer: Simon McVittie <smcv@debian.org>
 Uploaders: Josh Triplett <josh@freedesktop.org>
 Standards-Version: 3.9.3
 Homepage: http://ikiwiki.info/
diff -Nru ikiwiki-3.20120629/doc/plugins/blogspam.mdwn ikiwiki-3.20120629.1/doc/plugins/blogspam.mdwn
--- ikiwiki-3.20120629/doc/plugins/blogspam.mdwn	2012-05-17 05:31:16.000000000 +0100
+++ ikiwiki-3.20120629.1/doc/plugins/blogspam.mdwn	2015-01-14 22:11:05.000000000 +0000
@@ -10,7 +10,7 @@
 To check for and moderate comments, log in to the wiki as an admin,
 go to your Preferences page, and click the "Comment Moderation" button.
 
-The plugin requires the [[!cpan RPC::XML]] perl module.
+The plugin requires the [[!cpan JSON]] perl module.
 
 You can control how content is tested via the `blogspam_options` setting.
 The list of options is [here](http://blogspam.net/api/testComment.html#options).
diff -Nru ikiwiki-3.20120629/IkiWiki/Plugin/blogspam.pm ikiwiki-3.20120629.1/IkiWiki/Plugin/blogspam.pm
--- ikiwiki-3.20120629/IkiWiki/Plugin/blogspam.pm	2012-05-17 05:31:15.000000000 +0100
+++ ikiwiki-3.20120629.1/IkiWiki/Plugin/blogspam.pm	2015-01-14 22:13:28.000000000 +0000
@@ -6,7 +6,8 @@
 use IkiWiki 3.00;
 use Encode;
 
-my $defaulturl='http://test.blogspam.net:8888/';
+my $defaulturl='http://test.blogspam.net:9999/';
+my $client;
 
 sub import {
 	hook(type => "getsetup", id => "blogspam",  call => \&getsetup);
@@ -33,14 +34,14 @@
 			type => "string",
 			example => "blacklist=1.2.3.4,blacklist=8.7.6.5,max-links=10",
 			description => "options to send to blogspam server",
-			link => "http://blogspam.net/api/testComment.html#options";,
+			link => "http://blogspam.net/api/2.0/testComment.html#options";,
 			safe => 1,
 			rebuild => 0,
 		},
 		blogspam_server => {
 			type => "string",
 			default => $defaulturl,
-			description => "blogspam server XML-RPC url",
+			description => "blogspam server JSON url",
 			safe => 1,
 			rebuild => 0,
 		},
@@ -51,10 +52,23 @@
 	# if the module is missing when a spam is posted would not
 	# let the admin know about the problem.
 	eval q{
-		use RPC::XML;
-		use RPC::XML::Client;
+		use JSON;
+		use HTTP::Request;
 	};
 	error $@ if $@;
+
+	eval q{use LWPx::ParanoidAgent};
+	if (!$@) {
+		$client=LWPx::ParanoidAgent->new();
+	}
+	else {
+		eval q{use LWP};
+		if ($@) {
+			error $@;
+			return;
+		}
+		$client=LWP::UserAgent->new(cookie_jar => $config{cookiejar});
+	}
 }
 
 sub checkcontent (@) {
@@ -76,8 +90,6 @@
 	my $url=$defaulturl;
 	$url = $config{blogspam_server} if exists $config{blogspam_server};
 
-	my $client = RPC::XML::Client->new($url);
-
 	my @options = split(",", $config{blogspam_options})
 		if exists $config{blogspam_options};
 
@@ -106,19 +118,28 @@
 		site => encode_utf8($config{url}),
 		version => "ikiwiki ".$IkiWiki::version,
 	);
-	my $res = $client->send_request('testComment', \%req);
+	eval q{use JSON; use HTTP::Request}; # errors handled in checkconfig()
+	my $res = $client->request(
+		HTTP::Request->new(
+			'POST',
+			$url,
+			[ 'Content-Type' => 'application/json' ],
+			to_json(\%req),
+		),
+	);
 
-	if (! ref $res || ! defined $res->value) {
+	if (! ref $res || ! $res->is_success()) {
 		debug("failed to get response from blogspam server ($url)");
 		return undef;
 	}
-	elsif ($res->value =~ /^SPAM:(.*)/) {
+	my $details = from_json($res->content);
+	if ($details->{result} eq 'SPAM') {
 		eval q{use Data::Dumper};
-		debug("blogspam server reports ".$res->value.": ".Dumper(\%req));
-		return gettext("Sorry, but that looks like spam to <a href=\"http://blogspam.net/\";>blogspam</a>: ").$1;
+		debug("blogspam server reports $details->{reason}: ".Dumper(\%req));
+		return gettext("Sorry, but that looks like spam to <a href=\"http://blogspam.net/\";>blogspam</a>: ").$details->{reason};
 	}
-	elsif ($res->value ne 'OK') {
-		debug("blogspam server failure: ".$res->value);
+	elsif ($details->{result} ne 'OK') {
+		debug("blogspam server failure: ".$res->content);
 		return undef;
 	}
 	else {
diff -Nru ikiwiki-3.20120629/ikiwiki.spec ikiwiki-3.20120629.1/ikiwiki.spec
--- ikiwiki-3.20120629/ikiwiki.spec	2012-05-17 05:31:16.000000000 +0100
+++ ikiwiki-3.20120629.1/ikiwiki.spec	2015-01-14 22:14:43.000000000 +0000
@@ -1,5 +1,5 @@
 Name:           ikiwiki
-Version: 3.20120516
+Version: 3.20120629.1
 Release:        1%{?dist}
 Summary:        A wiki compiler
 
diff -Nru ikiwiki-3.20120629/po/ikiwiki.pot ikiwiki-3.20120629.1/po/ikiwiki.pot
--- ikiwiki-3.20120629/po/ikiwiki.pot	2012-05-17 05:31:16.000000000 +0100
+++ ikiwiki-3.20120629.1/po/ikiwiki.pot	2015-01-14 22:14:02.000000000 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-05-16 20:03-0400\n"
+"POT-Creation-Date: 2015-01-07 21:10+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -188,7 +188,7 @@
 msgid "creating index page %s"
 msgstr ""
 
-#: ../IkiWiki/Plugin/blogspam.pm:118
+#: ../IkiWiki/Plugin/blogspam.pm:139
 msgid ""
 "Sorry, but that looks like spam to <a href=\"http://blogspam.net/";
 "\">blogspam</a>: "
@@ -537,15 +537,15 @@
 msgid "redir cycle is not allowed"
 msgstr ""
 
-#: ../IkiWiki/Plugin/meta.pm:433
+#: ../IkiWiki/Plugin/meta.pm:434
 msgid "sort=meta requires a parameter"
 msgstr ""
 
-#: ../IkiWiki/Plugin/mirrorlist.pm:44
+#: ../IkiWiki/Plugin/mirrorlist.pm:57
 msgid "Mirrors"
 msgstr ""
 
-#: ../IkiWiki/Plugin/mirrorlist.pm:44
+#: ../IkiWiki/Plugin/mirrorlist.pm:57
 msgid "Mirror"
 msgstr ""
 

Reply to: