-sub footer {
- my ($ctx) = @_;
- return '' unless $ctx;
- my $git_dir = ctx_get($ctx, 'git_dir');
-
- # favor user-supplied footer
- my $footer = try_cat("$git_dir/public-inbox/footer.html");
- if (defined $footer) {
- chomp $footer;
- $ctx->{footer} = $footer;
- return $footer;
- }
-
- # auto-generate a footer
- my $listname = ctx_get($ctx, 'listname');
- my $desc = try_cat("$git_dir/description");
- $desc = '$GIT_DIR/description missing' unless defined $desc;
- chomp $desc;
-
- my $urls = try_cat("$git_dir/cloneurl");
- my @urls = split(/\r?\n/, $urls || '');
- my %seen = map { $_ => 1 } @urls;
- my $cgi = $ctx->{cgi};
- my $http = $cgi->base->as_string . $listname;
- $seen{$http} or unshift @urls, $http;
- my $ssoma_url = PublicInbox::Hval::prurl($cgi->{env}, SSOMA_URL);
- if (scalar(@urls) == 1) {
- $urls = "URL for <a\nhref=\"" . $ssoma_url .
- qq(">ssoma</a> or <b>git clone --mirror $urls[0]</b>);
- } else {
- $urls = "URLs for <a\nhref=\"" . $ssoma_url .
- qq(">ssoma</a> or <b>git clone --mirror</b>\n) .
- join("\n", map { "\tgit clone --mirror $_" } @urls);
- }
-
- my $addr = $ctx->{pi_config}->get($listname, 'address');
- if (ref($addr) eq 'ARRAY') {
- $addr = $addr->[0]; # first address is primary
- }
-
- $addr = "<a\nhref=\"mailto:$addr\">$addr</a>";
-
- $ctx->{footer} = join("\n",
- '- ' . $desc,
- "A <a\nhref=\"" .
- PublicInbox::Hval::prurl($ctx->{cgi}->{env}, PI_URL) .
- '">public-inbox</a>, ' .
- 'anybody may post in plain-text (not HTML):',
- $addr,
- $urls
- );
-}
-