diff options
author | Eric Wong <e@yhbt.net> | 2020-07-05 23:27:52 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-07-06 20:01:15 +0000 |
commit | 1cf5a6129b5ae4991275862aab539ddea812890a (patch) | |
tree | c3d20a71d82ca9cc07c2b45740a2819529d9f76e /lib/PublicInbox/View.pm | |
parent | 208450d2347ab92de7dcb9733fb51543df32635a (diff) | |
download | public-inbox-1cf5a6129b5ae4991275862aab539ddea812890a.tar.gz |
All of our streaming responses use ::aresponse, now, and our synchronous responses use html_oneshot. So there's no need for the old WwwStream::response.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r-- | lib/PublicInbox/View.pm | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 138e0c3a..895e4f27 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -14,7 +14,7 @@ use PublicInbox::MID qw(id_compress mids mids_for_index references $MID_EXTRACT); use PublicInbox::MsgIter; use PublicInbox::Address; -use PublicInbox::WwwStream; +use PublicInbox::WwwStream qw(html_oneshot); use PublicInbox::Reply; use PublicInbox::ViewDiff qw(flush_diff); use PublicInbox::Eml; @@ -45,25 +45,20 @@ sub msg_page_i { } } -# /$INBOX/$MESSAGE_ID/ for unindexed v1 inboxes -sub no_over_i { +# /$INBOX/$MSGID/ for unindexed v1 inboxes +sub no_over_html ($) { my ($ctx) = @_; - my $eml = delete $ctx->{eml} or return; + my $bref = $ctx->{-inbox}->msg_by_mid($ctx->{mid}) or return; # 404 + my $eml = PublicInbox::Eml->new($bref); my $hdr = $eml->header_obj; $ctx->{mhref} = ''; + PublicInbox::WwwStream::init($ctx); my $obuf = $ctx->{obuf} = _msg_page_prepare_obuf($hdr, $ctx); multipart_text_as_html($eml, $ctx); delete $ctx->{obuf}; $$obuf .= '</pre><hr>'; eval { $$obuf .= html_footer($ctx, $hdr) }; - $$obuf -} - -sub no_over_html ($) { - my ($ctx) = @_; - my $bref = $ctx->{-inbox}->msg_by_mid($ctx->{mid}) or return; # 404 - $ctx->{eml} = PublicInbox::Eml->new($bref); - PublicInbox::WwwStream::response($ctx, 200, \&no_over_i); + html_oneshot($ctx, 200, $obuf); } # public functions: (unstable) @@ -1169,12 +1164,6 @@ sub pagination_footer ($$) { "<hr><pre>page: $next$prev</pre>"; } -sub index_nav { # callback for WwwStream::getline - my ($ctx) = @_; - return $ctx->html_top if exists $ctx->{-html_tip}; - pagination_footer($ctx, '.') -} - sub paginate_recent ($$) { my ($ctx, $lim) = @_; my $t = $ctx->{qp}->{t} || ''; @@ -1223,7 +1212,8 @@ sub index_topics { if (@$msgs) { walk_thread(thread_results($ctx, $msgs), $ctx, \&acc_topic); } - PublicInbox::WwwStream::response($ctx, dump_topics($ctx), \&index_nav); + html_oneshot($ctx, dump_topics($ctx), \pagination_footer($ctx, '.')); + } sub thread_adj_level { |