From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, URIBL_RED shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DFA5F203C2 for ; Thu, 21 Jul 2016 02:02:23 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/2] www: a note .onion URLs require the usage of Tor Date: Thu, 21 Jul 2016 02:02:21 +0000 Message-Id: <20160721020222.15358-2-e@80x24.org> In-Reply-To: <20160721020222.15358-1-e@80x24.org> References: <20160721020222.15358-1-e@80x24.org> List-Id: Not everybody knows what .onion URLs are, so refer them to Tor. --- lib/PublicInbox/WwwStream.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index bdc8048..de457b4 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -8,6 +8,7 @@ use warnings; use PublicInbox::Hval qw(ascii_html); use URI; use constant PI_URL => 'https://public-inbox.org/'; +our $TOR_URL = 'https://www.torproject.org/'; sub close {} @@ -68,8 +69,10 @@ sub _html_end { chop $http; my %seen = ( $http => 1 ); my @urls = ($http); + my $need_tor; foreach my $u (@{$obj->cloneurl}) { next if $seen{$u}; + $need_tor = 1 if $u =~ m!\A[^:]+://\w+\.onion/!; $seen{$u} = 1; push @urls, $u =~ /\Ahttps?:/ ? qq($u) : $u; } @@ -79,12 +82,17 @@ sub _html_end { $urls .= "\n" . join("\n", map { "\tgit clone --mirror $_" } @urls); } + + if ($need_tor) { + $urls .= "\n note: .onion URLs require Tor: "; + $urls .= qq[$TOR_URL]; + } my $url = PublicInbox::Hval::prurl($ctx->{env}, PI_URL); - '
'.join("\n",
-		'- ' . $desc,
+	'
'.join("\n\n",
+		$desc,
 		$urls,
 		'Served with public-inbox: '.
-		qq(git clone $url public-inbox),
+		qq(git clone $url public-inbox)
 	).'
'; } -- EW