From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD,URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7C1E1202F6 for ; Sat, 13 Feb 2016 23:13:05 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] www: advertise clone-ability over http/https Date: Sat, 13 Feb 2016 23:13:05 +0000 Message-Id: <20160213231305.1147-1-e@80x24.org> List-Id: All public-inbox instances shall be clone-able. --- lib/PublicInbox/WWW.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index b4b012f..95dfcbf 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -244,10 +244,12 @@ sub footer { my $urls = try_cat("$git_dir/cloneurl"); my @urls = split(/\r?\n/, $urls || ''); - my $nurls = scalar @urls; - if ($nurls == 0) { - $urls = '($GIT_DIR/cloneurl missing)'; - } elsif ($nurls == 1) { + my %seen = map { $_ => 1 } @urls; + my $cgi = $ctx->{cgi}; + my $http = (ref($cgi) eq 'CGI') ? $cgi->url(-base) . "/$listname" : + $cgi->base->as_string . $listname; + $seen{$http} or unshift @urls, $http; + if (scalar(@urls) == 1) { $urls = "git URL for ssoma: ' . $urls[0]; } else { -- EW