From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A7D9E1F4B4 for ; Tue, 15 Sep 2020 20:15:24 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] wwwstream: link to cgit URLs for coderepo Date: Tue, 15 Sep 2020 20:15:24 +0000 Message-Id: <20200915201524.15535-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Hopefully this reduces the ambiguity between code for the project(s) using public-inbox and the code for public-inbox itself. --- lib/PublicInbox/WwwStream.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index f7e09c24..638f4e27 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -76,6 +76,26 @@ sub html_top ($) { ''. $top . (delete($ctx->{-html_tip}) // ''); } +sub coderepos ($) { + my ($ctx) = @_; + my $ibx = $ctx->{-inbox}; + my @ret; + if (defined(my $cr = $ibx->{coderepo})) { + my $cfg = $ctx->{www}->{pi_config}; + my $env = $ctx->{env}; + for my $cr_name (@$cr) { + my $urls = $cfg->{"coderepo.$cr_name.cgiturl"}; + if ($urls) { + $ret[0] //= <
'.join("\n\n",
 		$desc,
 		$urls,
+		coderepos($ctx),
 		code_footer($ctx->{env})
 	).'
'; }