url_regexp or return $ctx->psgi_triple;
my $iter = PublicInbox::ConfigIter->new($ctx->{www}->{pi_config},
\&list_match_i, $re, $ctx);
sub {
$ctx->{-wcb} = $_[0]; # HTTP server callback
$ctx->{env}->{'pi-httpd.async'} ?
$iter->event_step : $iter->each_section;
}
}
sub psgi_triple {
my ($ctx) = @_;
my $h = [ 'Content-Type', 'text/html; charset=UTF-8',
'Content-Length', undef ];
my $gzf = gzf_maybe($h, $ctx->{env});
$gzf->zmore('' .
'public-inbox listing' .
'');
my $code = 404;
if (my $list = $ctx->{-list}) {
$code = 200;
# sort by ->modified
@$list = map { $_->[1] } sort { $b->[0] <=> $a->[0] } @$list;
$list = join("\n", @$list);
my $l = PublicInbox::Linkify->new;
$gzf->zmore($l->to_html($list));
} else {
$gzf->zmore('no inboxes, yet');
}
my $out = $gzf->zflush('
'.
PublicInbox::WwwStream::code_footer($ctx->{env}) .
'
');
$h->[3] = bytes::length($out);
[ $code, $h, [ $out ] ];
}
1;