]> Sergey Matveev's repositories - public-inbox.git/commitdiff
support multiple CODE_URLs
authorEric Wong <e@80x24.org>
Mon, 21 Dec 2020 22:10:55 +0000 (22:10 +0000)
committerEric Wong <e@80x24.org>
Tue, 22 Dec 2020 03:36:56 +0000 (03:36 +0000)
public-inbox.org will expire in a few years, so ensure Tor .onions
can be known before then.

Documentation/mknews.perl
README
lib/PublicInbox/Unsubscribe.pm
lib/PublicInbox/WwwStream.pm

index d87c260918c9c048544375ebf3c370fb8b6565f3..a11dd5f01fde6dd77041049db7a8d3bed76e3c06 100755 (executable)
@@ -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 ae428bcfe11796657c97913dabdf45b5a2bc9fd2..6396373f4c57f7621256545ead60dd5bf2352c5c 100644 (file)
--- 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.
index b0d3220c3b51f6b80ee80dcffedc401ac282510c..ae0b06793f6f81d85e5a42ea7e9b7671151c5599 100644 (file)
@@ -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>'
        ] ];
index 49940262eeb6469fbc0cf3a82970ece740440dcd..9ba8fa114de43a6c5621915f2e035d548fa348b9 100644 (file)
@@ -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;