]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WWW.pm
update copyright headers and email addresses
[public-inbox.git] / lib / PublicInbox / WWW.pm
index 5584e49bf6a993e101a941111a5fbf147397121f..508abf73856c3daf08614a9342b91670280cad5f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014, Eric Wong <normalperson@yhbt.net> and all contributors
+# Copyright (C) 2014-2015 all contributors <meta@public-inbox.org>
 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
 #
 # We focus on the lowest common denominators here:
@@ -67,6 +67,7 @@ sub preload {
 
        eval {
                require PublicInbox::Search;
+               require PublicInbox::SearchView;
                require PublicInbox::Mbox;
                require IO::Compress::Gzip;
        };
@@ -78,6 +79,7 @@ sub r404 {
        my ($ctx) = @_;
        if ($ctx && $ctx->{mid}) {
                require PublicInbox::ExtMsg;
+               searcher($ctx);
                return PublicInbox::ExtMsg::ext_msg($ctx);
        }
        r(404, 'Not Found');
@@ -128,8 +130,14 @@ sub get_index {
        my ($ctx) = @_;
        require PublicInbox::Feed;
        my $srch = searcher($ctx);
+       my $q = $ctx->{cgi}->param('q');
        footer($ctx);
-       PublicInbox::Feed::generate_html_index($ctx);
+       if (defined $q) {
+               require PublicInbox::SearchView;
+               PublicInbox::SearchView::sres_top_html($ctx, $q);
+       } else {
+               PublicInbox::Feed::generate_html_index($ctx);
+       }
 }
 
 # just returns a string ref for the blob in the current ctx