{url});
- my $tmp = <<"";
-* $ts - $url
- ${\$ibx->description}
+sub hide_key { 'www' }
- if (defined(my $info_url = $ibx->{infourl})) {
- $tmp .= ' ' . prurl($env, $info_url) . "\n";
+sub response {
+ my ($class, $ctx) = @_;
+ bless $ctx, $class;
+ if (my $ALL = $ctx->{www}->{pi_cfg}->ALL) {
+ $ALL->misc->reopen;
+ }
+ my $re = $ctx->url_regexp or return $ctx->psgi_triple;
+ my $iter = PublicInbox::ConfigIter->new($ctx->{www}->{pi_cfg},
+ \&list_match_i, $re, $ctx);
+ sub {
+ $ctx->{-wcb} = $_[0]; # HTTP server callback
+ $ctx->{env}->{'pi-httpd.async'} ?
+ $iter->event_step : $iter->each_section;
}
- $tmp;
}
-sub html ($$) {
- my ($env, $list) = @_;
+sub psgi_triple {
+ my ($ctx) = @_;
my $h = [ 'Content-Type', 'text/html; charset=UTF-8',
'Content-Length', undef ];
- my $gzf = gzf_maybe($h, $env) || PublicInbox::NoopFilter::new();
+ my $gzf = gzf_maybe($h, $ctx->{env});
$gzf->zmore('' .
'public-inbox listing' .
'');
my $code = 404;
- if (@$list) {
+ if (my $list = $ctx->{-list}) {
$code = 200;
- # Schwartzian transform since Inbox->modified is expensive
- @$list = sort {
- $b->[0] <=> $a->[0]
- } map { [ $_->modified, $_ ] } @$list;
-
- my $tmp = join("\n", map { ibx_entry(@$_, $env) } @$list);
+ # 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($tmp));
+ $gzf->zmore($l->to_html($list));
} else {
$gzf->zmore('no inboxes, yet');
}
my $out = $gzf->zflush('
'.
- PublicInbox::WwwStream::code_footer($env) .
- '
');
+ PublicInbox::WwwStream::code_footer($ctx->{env}) .
+ '