user/dev discussion of public-inbox itself
 help / color / mirror / Atom feed
* [PATCH] wwwstream: link to cgit URLs for coderepo
@ 2020-09-15 20:15 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-09-15 20:15 UTC (permalink / raw)
  To: meta

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 ($) {
 		'</head><body>'. $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] //= <<EOF;
+code repositories for the project(s) associated with this inbox:
+EOF
+				$ret[0] .= "\n\t".prurl($env, $_) for @$urls;
+			}
+		}
+	}
+	@ret; # may be empty
+}
+
 sub code_footer ($) {
 	my ($env) = @_;
 	my $u = prurl($env, $CODE_URL);
@@ -153,6 +173,7 @@ EOF
 	'<hr><pre>'.join("\n\n",
 		$desc,
 		$urls,
+		coderepos($ctx),
 		code_footer($ctx->{env})
 	).'</pre></body></html>';
 }

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

only message in thread, other threads:[~2020-09-15 20:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 20:15 [PATCH] wwwstream: link to cgit URLs for coderepo 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