OSDN Git Service

implement filtering feature for timeline (currently works journal only)
[newslash/newslash.git] / src / newslash_web / lib / Newslash / Web.pm
index 8282e7b..33b705f 100644 (file)
@@ -50,6 +50,7 @@ sub startup {
            my $loglv = $cnf->{level};
            if (grep { $loglv eq $_ } qw(debug info warn error fatal)) {
                $app->log->level($loglv);
+               $app->log->info("set log level to $loglv");
            }
            else {
                $app->log->warn('invalid log level given in config file');
@@ -146,7 +147,10 @@ sub startup {
     $app->plugin('Newslash::Plugin::Model', { bypass_startup => $maintenance_mode });
 
     # use Easy Cache ($app->ezcache)
-    $app->plugin('Newslash::Plugin::EasyCache');
+    #$app->plugin('Newslash::Plugin::EasyCache');
+
+    # use CompositeCache Cache ($app->ccache)
+    $app->plugin('Newslash::Plugin::CompositeCache');
 
     # use Template::Toolkit 2 render
     $app->plugin('Newslash::Plugin::TT2Renderer');
@@ -187,6 +191,9 @@ sub startup {
     # ReCaptcha control
     $app->plugin('Newslash::Plugin::ReCaptcha');
 
+    # Post Filter
+    $app->plugin('Newslash::Plugin::PostFilter');
+
     # set canocal (for test.srad.jp)
     $app->plugin('Newslash::Plugin::Canonical');
 
@@ -199,8 +206,8 @@ sub startup {
     # Event Que
     $app->plugin('Newslash::Plugin::EventQue');
 
-    # Statics Logger
-    $app->plugin('Newslash::Plugin::Statics');
+    # Stats Logger
+    $app->plugin('Newslash::Plugin::Stats');
 
     # Request Body based routing condition
     $app->plugin('Newslash::Plugin::RequestBodyCondition');
@@ -223,6 +230,9 @@ sub startup {
     # Sendmail helper
     $app->plugin('Newslash::Plugin::Sendmail');
 
+    # Wiki contents reader helper
+    $app->plugin('Newslash::Plugin::WikiContentsReader');
+
     ############################################################
     #
     # Routing Settings
@@ -241,7 +251,8 @@ sub startup {
     $r->get('/polls')->to('timeline#polls');
 
     # RSS
-    $r->get('/:rss_type' => [format => ['rss', 'xml']])->to('rss#timeline');
+    $r->get('/:rss_type' => [format => ['rss', 'xml']])->to('rss#stories');
+    $r->get('/journals/rss')->to('rss#journals');
 
     # Banned page
     $r->get('/banned')->to('index#banned', noindex => 1);
@@ -259,6 +270,7 @@ sub startup {
     $r->get('/comment/:cid/')->to('comment#single');
 
     # journal page
+    # also see user page settings for /~username/journal/
     $r->get('/journal/new')->to('journal#create', seclev => 1);
     $r->get('/journal/:id/')->to('journal#single');
 
@@ -285,6 +297,10 @@ sub startup {
     $r->get('/submission/:year/:month/')->to('archive#submission');
     $r->get('/submission/')->to('archive#submission');
 
+    $r->get('/comment/:year/:month/:day/')->to('archive#comment');
+    $r->get('/comment/:year/:month/')->to('archive#comment');
+    $r->get('/comment/')->to('archive#comment');
+
     $r->get('/poll/:year/:month/')->to('archive#poll');
     $r->get('/poll/')->to('archive#poll');
 
@@ -312,6 +328,20 @@ sub startup {
     # search page
     $r->get('/search')->to('search#search');
 
+    # about
+    $r->get('/about')->to('about#about');
+
+    #faq
+    $r->get('/faq/editorial')->to('faq#editorial');
+    $r->get('/faq/UI')->to('faq#UI');
+    $r->get('/faq/firehose')->to('faq#firehose');
+    $r->get('/faq/com-mod')->to('faq#com_mod');
+    $r->get('/faq/metamod')->to('faq#metamod');
+    $r->get('/faq/accounts')->to('faq#accounts');
+    $r->get('/faq/friends')->to('faq#friends');
+    $r->get('/faq/tech')->to('faq#tech');
+    $r->get('/faq/')->to('faq#faq');
+
     # Admin
     # pages under /admin needs seclev equal or greater than 10000;
     my $admin = $r->under('/admin' => sub { my $c = shift; $c->stash(seclev => 10000); return 1; });
@@ -328,6 +358,7 @@ sub startup {
 
     $admin->get('/sidebar')->to('admin-sidebar#index');
     $admin->get('/feed')->to('admin-feed#index');
+    $admin->get('/filter')->to('admin-filter#index');
     $admin->get('/blocking')->to('admin-blocking#index');
     $admin->get('/ad')->to('admin-ads#index');
 
@@ -337,8 +368,11 @@ sub startup {
     # Admin API
     # pages under /api/v1/admin needs seclev equal or greater than 10000;
     my $admin_api = $r->under('/api/v1/admin' => sub { my $c = shift; $c->stash(seclev => 10000); return 1; });
+
     $admin_api->get('/feed')->to('API::Admin::Feed#get');
     $admin_api->post('/feed')->to('API::Admin::Feed#post');
+    $admin_api->get('/filter')->to('API::Admin::Filter#get');
+    $admin_api->post('/filter')->to('API::Admin::Filter#post');
     $admin_api->get('/blocking')->to('API::Admin::Blocking#get');
     $admin_api->post('/blocking')->to('API::Admin::Blocking#post');
 
@@ -380,6 +414,8 @@ sub startup {
     $api->get('/story')->to('API::Story#get');
     $api->post('/story')->to('API::Story#post');
 
+    $api->get('/timeline')->to('API::Timeline#get');
+
     $api->get('/poll')->to('API::Poll#get');
     $api->post('/poll')->to('API::Poll#post');
     $api->post('/vote')->to('API::Poll#vote', csrf_check_id => 'vote');
@@ -398,6 +434,7 @@ sub startup {
     # warning: these pathes uses regexp matching, so must write in tail of route definitions.
     my $user = $r->under('/~:nickname');
     $user->get('/'             => [nickname => qr/.*/])->to('user#home');
+    $user->get('/journal/:id'  => [nickname => qr/.*/])->to('journal#single');
     $user->get('/journals'     => [nickname => qr/.*/])->to('user#journals');
     $user->get('/journal'      => [nickname => qr/.*/])->to('user#journals'); # for compatibility
     $user->get('/comments'     => [nickname => qr/.*/])->to('user#comments');
@@ -407,7 +444,6 @@ sub startup {
     $user->get('/fans'         => [nickname => qr/.*/])->to('user#fans');
     $user->get('/freaks'       => [nickname => qr/.*/])->to('user#freaks');
     $user->get('/achievements' => [nickname => qr/.*/])->to('user#achievements');
-    #$r->get('/:user_name/journal' => [user_name => qr/~.*/])->to('journal#user_journals');
 
 }