* [PATCH 1/2] www: a note .onion URLs require the usage of Tor
2016-07-21 2:02 [PATCH 0/2] www: footer tweaks Eric Wong
@ 2016-07-21 2:02 ` Eric Wong
2016-07-21 2:02 ` [PATCH 2/2] www: redefinable project name and URL Eric Wong
1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-07-21 2:02 UTC (permalink / raw)
To: meta
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(<a\nhref="$u">$u</a>) : $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[<a\nhref="$TOR_URL">$TOR_URL</a>];
+ }
my $url = PublicInbox::Hval::prurl($ctx->{env}, PI_URL);
- '<hr><pre>'.join("\n",
- '- ' . $desc,
+ '<hr><pre>'.join("\n\n",
+ $desc,
$urls,
'Served with public-inbox: '.
- qq(git clone <a\nhref="$url">$url</a> public-inbox),
+ qq(git clone <a\nhref="$url">$url</a> public-inbox)
).'</pre></body></html>';
}
--
EW
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] www: redefinable project name and URL
2016-07-21 2:02 [PATCH 0/2] www: footer tweaks Eric Wong
2016-07-21 2:02 ` [PATCH 1/2] www: a note .onion URLs require the usage of Tor Eric Wong
@ 2016-07-21 2:02 ` Eric Wong
1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2016-07-21 2:02 UTC (permalink / raw)
To: meta
This should make it easier for folks to run their own forks.
---
lib/PublicInbox/WwwStream.pm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index de457b4..ec9ae0c 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -7,8 +7,9 @@ use strict;
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/';
+our $CODE_URL = 'https://public-inbox.org/';
+our $PROJECT = 'public-inbox';
sub close {}
@@ -87,12 +88,12 @@ sub _html_end {
$urls .= "\n note: .onion URLs require Tor: ";
$urls .= qq[<a\nhref="$TOR_URL">$TOR_URL</a>];
}
- my $url = PublicInbox::Hval::prurl($ctx->{env}, PI_URL);
+ my $url = PublicInbox::Hval::prurl($ctx->{env}, $CODE_URL);
'<hr><pre>'.join("\n\n",
$desc,
$urls,
- 'Served with public-inbox: '.
- qq(git clone <a\nhref="$url">$url</a> public-inbox)
+ 'Code for this site: '.
+ qq(git clone <a\nhref="$url">$url</a> $PROJECT)
).'</pre></body></html>';
}
--
EW
^ permalink raw reply related [flat|nested] 3+ messages in thread