From aed2002eec05e5c51d6cac8775866667d6518361 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 21 Jul 2016 01:50:01 +0000 Subject: www: a note .onion URLs require the usage of Tor Not everybody knows what .onion URLs are, so refer them to Tor. --- lib/PublicInbox/WwwStream.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index bdc8048d..de457b48 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)
 	).'
'; } -- cgit v1.2.3-24-ge0c7