X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FFeed.pm;h=65adf373a7400d42b63e1acd85f951db1d0b2298;hb=a380c9b55b39a4db6a21131332a2a5629428dded;hp=026a069e872e015c461265b4d6fe72e97da1f268;hpb=8e85257577ee4d7d49e59f048852d9d4ac6f8172;p=public-inbox.git diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 026a069e..65adf373 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -31,7 +31,19 @@ sub generate_thread_atom { sub generate_html_index { my ($ctx) = @_; - sub { emit_html_index($_[0], $ctx) }; + # if the 'r' query parameter is given, it is a legacy permalink + # which we must continue supporting: + my $qp = $ctx->{qp}; + if ($qp && !$qp->{r} && $ctx->{srch}) { + return PublicInbox::View::index_topics($ctx); + } + + my $env = $ctx->{env}; + my $url = $ctx->{-inbox}->base_url($env) . 'new.html'; + my $qs = $env->{QUERY_STRING}; + $url .= "?$qs" if $qs ne ''; + [302, [ 'Location', $url, 'Content-Type', 'text/plain'], + [ "Redirecting to $url\n" ] ]; } sub new_html { @@ -56,7 +68,7 @@ sub new_html { $s .= '' unless $more; return $s; } - undef; + new_html_footer($ctx, $last); }); } @@ -159,74 +171,20 @@ sub _html_index_top { "
$top"; } -sub emit_html_index { - my ($res, $ctx) = @_; - my $feed_opts = get_feedopts($ctx); - my $fh = $res->([200,['Content-Type'=>'text/html; charset=UTF-8']]); - - my $max = $ctx->{max} || MAX_PER_PAGE; - $ctx->{-upfx} = ''; - - my ($footer, $param, $last); - $ctx->{seen} = {}; - $ctx->{anchor_idx} = 0; - $ctx->{fh} = $fh; - my $srch = $ctx->{srch}; - $fh->write(_html_index_top($feed_opts, $srch)); - - # if the 'r' query parameter is given, it is a legacy permalink - # which we must continue supporting: - my $qp = $ctx->{qp}; - if ($qp && !$qp->{r} && $srch) { - $last = PublicInbox::View::emit_index_topics($ctx); - $param = 'o'; - } else { - $last = emit_index_nosrch($ctx); - $param = 'r'; - } - $footer = nav_footer($ctx, $last, $feed_opts, $param); - if ($footer) { - my $list_footer = $ctx->{footer}; - $footer .= "\n\n" . $list_footer if $list_footer; - $footer = "$footer"; - } - $fh->write("$footer