-sub _html_end {
- my ($self) = @_;
- my $urls = 'Archives are clonable:';
- my $ctx = $self->{ctx};
- my $obj = $ctx->{-inbox};
- my $desc = ascii_html($obj->description);
-
- my $http = $obj->base_url($ctx->{env});
- chop $http;
- my %seen = ( $http => 1 );
- my @urls = ($http);
- foreach my $u (@{$obj->cloneurl}) {
- next if $seen{$u};
- $seen{$u} = 1;
- push @urls, $u =~ /\Ahttps?:/ ? qq(<a\nhref="$u">$u</a>) : $u;
- }
- if (scalar(@urls) == 1) {
- $urls .= " git clone --mirror $http";
- } else {
- $urls .= "\n" .
- join("\n", map { "\tgit clone --mirror $_" } @urls);
- }
-
- my @nntp = map { qq(<a\nhref="$_">$_</a>) } @{$obj->nntp_url};
- if (@nntp) {
- $urls .= "\n\n";
- $urls .= @nntp == 1 ? 'Newsgroup' : 'Newsgroups are';
- $urls .= ' available over NNTP:';
- $urls .= "\n\t" . join("\n\t", @nntp) . "\n";
- }
- if ($urls =~ m!\b[^:]+://\w+\.onion/!) {
- $urls .= "\n note: .onion URLs require Tor: ";
- $urls .= qq[<a\nhref="$TOR_URL">$TOR_URL</a>];
- if ($TOR2WEB_URL) {
- $urls .= "\n or Tor2web: ";
- $urls .= qq[<a\nhref="$TOR2WEB_URL">$TOR2WEB_URL</a>];
+sub coderepos ($) {
+ my ($ctx) = @_;
+ my $cr = $ctx->{ibx}->{coderepo} // return ();
+ my $cfg = $ctx->{www}->{pi_cfg};
+ my $upfx = ($ctx->{-upfx} // ''). '../';
+ my @ret;
+ for my $cr_name (@$cr) {
+ $ret[0] //= <<EOF;
+<a id=code>code repositories for project(s) associated with this inbox:
+EOF
+ my $urls = $cfg->get_all("coderepo.$cr_name.cgiturl");
+ if ($urls) {
+ for (@$urls) {
+ # relative or absolute URL?, prefix relative
+ # "foo.git" with appropriate number of "../"
+ my $u = m!\A(?:[a-z\+]+:)?//! ? $_ : $upfx.$_;
+ $u = ascii_html(prurl($ctx->{env}, $u));
+ $ret[0] .= qq(\n\t<a\nhref="$u">$u</a>);
+ }
+ } else {
+ $ret[0] .= qq[\n\t$cr_name.git (no URL configured)];