user/dev discussion of public-inbox itself
 help / color / mirror / Atom feed
* [PATCH] www: make mirror instructions more prominent
@ 2020-09-08  8:29 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-09-08  8:29 UTC (permalink / raw)
  To: meta

In order to fight the misconception that public-inboxes are
centralized, anchor "#mirror" to the clone instructions and
place an emphasis on "mirror", not just cloning.

While we're at it, better describe multi-epoch -V2 inboxes,
since some users do not seem to realize epochs consist of
different data.
---
 lib/PublicInbox/WwwStream.pm | 37 ++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index e06e3456..f1b5119a 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -50,9 +50,10 @@ sub html_top ($) {
 	} elsif ($ctx->{qp}->{t}) {
 		$top = qq(<a\nhref="./">$top</a>);
 	}
-	my $links = "<a\nhref=\"$help\">help</a> / ".
-			"<a\nhref=\"$color\">color</a> / ".
-			"<a\nhref=\"$atom\">Atom feed</a>";
+	my $links = qq(<a\nhref="$help">help</a> / ).
+			qq(<a\nhref="$color">color</a> / ).
+			qq(<a\nhref=#mirror>mirror</a> / ).
+			q(<a\nhref="$atom">Atom feed</a>);
 	if ($ibx->search) {
 		my $q_val = delete($ctx->{-q_value_html}) // '';
 		$q_val = qq(\nvalue="$q_val") if $q_val ne '';
@@ -83,7 +84,11 @@ sub code_footer ($) {
 
 sub _html_end {
 	my ($ctx) = @_;
-	my $urls = 'Archives are clonable:';
+	my $urls = <<EOF;
+<a
+id=mirror>This inbox may be cloned and mirrored by anyone:</a>
+EOF
+
 	my $ibx = $ctx->{-inbox};
 	my $desc = ascii_html($ibx->description);
 
@@ -94,12 +99,18 @@ sub _html_end {
 	my %seen = ($http => 1);
 	if (defined($max)) { # v2
 		for my $i (0..$max) {
-			# old parts my be deleted:
+			# old epochs my be deleted:
 			-d "$ibx->{inboxdir}/git/$i.git" or next;
 			my $url = "$http/$i";
 			$seen{$url} = 1;
 			push @urls, "$url $dir/git/$i.git";
 		}
+		my $nr = scalar(@urls);
+		if ($nr > 1) {
+			$urls .= "\n\t# this inbox consists of $nr epochs:";
+			$urls[0] .= "\t# oldest";
+			$urls[-1] .= "\t# newest";
+		}
 	} else { # v1
 		push @urls, $http;
 	}
@@ -111,12 +122,7 @@ sub _html_end {
 		push @urls, $u =~ /\Ahttps?:/ ? qq(<a\nhref="$u">$u</a>) : $u;
 	}
 
-	if (defined($max) || scalar(@urls) > 1) {
-		$urls .= "\n" .
-			join("\n", map { "\tgit clone --mirror $_" } @urls);
-	} else {
-		$urls .= " git clone --mirror $urls[0]";
-	}
+	$urls .= "\n" .  join("\n", map { "\tgit clone --mirror $_" } @urls);
 	if (defined $max) {
 		my $addrs = $ibx->{address};
 		$addrs = join(' ', @$addrs) if ref($addrs) eq 'ARRAY';
@@ -134,16 +140,19 @@ EOF
 	}
 
 	my $cfg_link = ($ctx->{-upfx} // '').'_/text/config/raw';
-	$urls .= qq(\nExample <a\nhref="$cfg_link">config snippet</a> for mirrors\n);
+	$urls .= <<EOF;
+
+Example <a
+href="$cfg_link">config snippet</a> for mirrors.
+EOF
 	my @nntp = map { qq(<a\nhref="$_">$_</a>) } @{$ibx->nntp_url};
 	if (@nntp) {
-		$urls .= "\n";
 		$urls .= @nntp == 1 ? 'Newsgroup' : 'Newsgroups are';
 		$urls .= ' available over NNTP:';
 		$urls .= "\n\t" . join("\n\t", @nntp) . "\n";
 	}
 	if ($urls =~ m!\b[^:]+://\w+\.onion/!) {
-		$urls .= "\n note: .onion URLs require Tor: ";
+		$urls .= " note: .onion URLs require Tor: ";
 		$urls .= qq[<a\nhref="$TOR_URL">$TOR_URL</a>];
 	}
 	'<hr><pre>'.join("\n\n",

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-08  8:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08  8:29 [PATCH] www: make mirror instructions more prominent Eric Wong

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git