diff options
author | Eric Wong <e@80x24.org> | 2016-07-06 01:37:20 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-07-06 07:12:45 +0000 |
commit | af70d4db0d539887d1688befff3f2faf0eeda30d (patch) | |
tree | ebce6b6e99d78132fc7f5abd5f78d3947908f5cc /lib | |
parent | 54fd19fc1ecb0bca805ed101416b8b0bb0a4c5d3 (diff) | |
download | public-inbox-af70d4db0d539887d1688befff3f2faf0eeda30d.tar.gz |
Another step towards a consistent WWW UI...
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/ExtMsg.pm | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index 4925a592..019d50a4 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -104,14 +104,12 @@ again: my $h = PublicInbox::Hval->new_msgid($mid); my $href = $h->as_href; my $html = $h->as_html; - my $title = "Message-ID <$html> not found"; - my $s = "<html><head><title>$title</title>" . - "</head><body><pre><b>$title</b>\n"; - + my $title = "<$html> not found"; + my $s = "<pre>Message-ID <$html>\nnot found\n"; if ($n_partial) { $code = 300; my $es = $n_partial == 1 ? '' : 'es'; - $s.= "\n$n_partial partial match$es found:\n\n"; + $s .= "\n$n_partial partial match$es found:\n\n"; foreach my $pair (@partial) { my ($ibx, $res) = @$pair; my $u = $ibx->base_url or next; @@ -123,21 +121,15 @@ again: } } } - - # Fall back to external repos if configured - if (@EXT_URL && index($mid, '@') >= 0) { + my $ext = ext_urls($ctx, $mid, $href, $html); + if ($ext ne '') { + $s .= $ext; $code = 300; - $s .= "\nPerhaps try an external site:\n\n"; - foreach my $url (@EXT_URL) { - my $u = PublicInbox::Hval::prurl($env, $url); - my $r = sprintf($u, $href); - my $t = sprintf($u, $html); - $s .= qq{<a\nhref="$r">$t</a>\n}; - } } - $s .= '</pre></body></html>'; - - [$code, ['Content-Type'=>'text/html; charset=UTF-8'], [$s]]; + $ctx->{-html_tip} = $s .= '</pre>'; + $ctx->{-title_html} = $title; + $ctx->{-upfx} = '../'; + PublicInbox::WwwStream->response($ctx, $code); } sub ext_urls { |