user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] support multiple CODE_URLs
Date: Mon, 21 Dec 2020 22:10:55 +0000	[thread overview]
Message-ID: <20201221221055.78123-1-e@80x24.org> (raw)

public-inbox.org will expire in a few years, so ensure Tor .onions
can be known before then.
---
 Documentation/mknews.perl      | 8 ++++----
 README                         | 1 +
 lib/PublicInbox/Unsubscribe.pm | 9 ++++++---
 lib/PublicInbox/WwwStream.pm   | 3 ++-
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Documentation/mknews.perl b/Documentation/mknews.perl
index d87c2609..a11dd5f0 100755
--- a/Documentation/mknews.perl
+++ b/Documentation/mknews.perl
@@ -119,10 +119,10 @@ sub html_start {
 }
 
 sub html_end {
-	print $out <<EOF or die;
-	git clone $PublicInbox::WwwStream::CODE_URL
-</pre></body></html>
-EOF
+	for (@$PublicInbox::WwwStream::CODE_URL) {
+		print $out "	git clone $_\n" or die;
+	}
+	print $out "</pre></body></html>\n" or die;
 }
 
 sub atom_start {
diff --git a/README b/README
index ae428bcf..6396373f 100644
--- a/README
+++ b/README
@@ -94,6 +94,7 @@ AGPL source code is available via git:
 
 	git clone https://public-inbox.org/public-inbox.git
 	git clone https://repo.or.cz/public-inbox.git
+	torsocks git clone http://ou63pmih66umazou.onion/public-inbox.git
 	torsocks git clone http://hjrcffqmbrq6wope.onion/public-inbox
 
 See below for contact info.
diff --git a/lib/PublicInbox/Unsubscribe.pm b/lib/PublicInbox/Unsubscribe.pm
index b0d3220c..ae0b0679 100644
--- a/lib/PublicInbox/Unsubscribe.pm
+++ b/lib/PublicInbox/Unsubscribe.pm
@@ -12,7 +12,8 @@ use warnings;
 use Crypt::CBC;
 use Plack::Util;
 use MIME::Base64 qw(decode_base64url);
-my $CODE_URL = 'https://public-inbox.org/public-inbox.git';
+my @CODE_URL = qw(http://ou63pmih66umazou.onion/public-inbox.git
+	https://public-inbox.org/public-inbox.git);
 my @CT_HTML = ('Content-Type', 'text/html; charset=UTF-8');
 
 sub new {
@@ -38,13 +39,15 @@ sub new {
 	my $unsubscribe = $opt{unsubscribe} or
 		die "`unsubscribe' callback not given\n";
 
+	my $code_url = $opt{code_url} || \@CODE_URL;
+	$code_url = [ $code_url ] if ref($code_url) ne 'ARRAY';
 	bless {
 		pi_cfg => $opt{pi_config}, # PublicInbox::Config
 		owner_email => $opt{owner_email},
 		cipher => $cipher,
 		unsubscribe => $unsubscribe,
 		contact => qq(<a\nhref="mailto:$e">$e</a>),
-		code_url => $opt{code_url} || $CODE_URL,
+		code_url => $code_url,
 		confirm => $opt{confirm},
 	}, $class;
 }
@@ -138,7 +141,7 @@ sub r {
 		"<html><head><title>$title</title></head><body><pre>".
 		join("\n", "<b>$title</b>\n", @body) . '</pre><hr>'.
 		"<pre>This page is available under AGPL-3.0+\n" .
-		"git clone $self->{code_url}\n" .
+		join('', map { "git clone $_\n" } @{$self->{code_url}}) .
 		qq(Email $self->{contact} if you have any questions).
 		'</pre></body></html>'
 	] ];
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 49940262..9ba8fa11 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -12,7 +12,8 @@ our @EXPORT_OK = qw(html_oneshot);
 use bytes (); # length
 use PublicInbox::Hval qw(ascii_html prurl ts2str);
 our $TOR_URL = 'https://www.torproject.org/';
-our $CODE_URL = 'https://public-inbox.org/public-inbox.git';
+our $CODE_URL = [ qw(http://ou63pmih66umazou.onion/public-inbox.git
+	https://public-inbox.org/public-inbox.git) ];
 
 sub base_url ($) {
 	my $ctx = shift;

                 reply	other threads:[~2020-12-21 22:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201221221055.78123-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).