package PublicInbox::WwwListing;
use strict;
use warnings;
-use PublicInbox::Hval qw(ascii_html prurl);
+use PublicInbox::Hval qw(ascii_html prurl fmt_ts);
use PublicInbox::Linkify;
use PublicInbox::View;
use PublicInbox::Inbox;
-use PublicInbox::NoopFilter;
use PublicInbox::GzipFilter qw(gzf_maybe);
use bytes (); # bytes::length
use HTTP::Date qw(time2str);
sub list_match_domain_i {
my ($ibx, $arg) = @_;
my ($list, $hide_key, $re) = @$arg;
- if (!$ibx->{-hide}->{$hide_key} && grep($re, @{$ibx->{url}})) {
+ if (!$ibx->{-hide}->{$hide_key} && grep(/$re/, @{$ibx->{url}})) {
push @$list, $ibx;
}
}
sub ibx_entry {
my ($mtime, $ibx, $env) = @_;
- my $ts = PublicInbox::View::fmt_ts($mtime);
+ my $ts = fmt_ts($mtime);
my $url = prurl($env, $ibx->{url});
my $tmp = <<"";
* $ts - $url
my ($env, $list) = @_;
my $h = [ 'Content-Type', 'text/html; charset=UTF-8',
'Content-Length', undef ];
- my $gzf = gzf_maybe($h, $env) || PublicInbox::NoopFilter::new();
- my $out = $gzf->zmore('<html><head><title>' .
+ my $gzf = gzf_maybe($h, $env);
+ $gzf->zmore('<html><head><title>' .
'public-inbox listing</title>' .
'</head><body><pre>');
my $code = 404;
my $tmp = join("\n", map { ibx_entry(@$_, $env) } @$list);
my $l = PublicInbox::Linkify->new;
- $out .= $gzf->zmore($l->to_html($tmp));
+ $gzf->zmore($l->to_html($tmp));
} else {
- $out .= $gzf->zmore('no inboxes, yet');
+ $gzf->zmore('no inboxes, yet');
}
- $out .= $gzf->zflush('</pre><hr><pre>'.
+ my $out = $gzf->zflush('</pre><hr><pre>'.
PublicInbox::WwwStream::code_footer($env) .
'</pre></body></html>');
$h->[3] = bytes::length($out);