X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=app.psgi;h=837dd60ab51e100408d84934eb6d7fd80a4a724c;hb=385eb223855d1d428d9cbf8b74c4fc60ebb510fe;hp=323748dc187169003ee5351db4191584ece46163;hpb=cbae57719c80843e922c3a1b248a56b8e8bff5b6;p=plack-app-gruntmaster.git diff --git a/app.psgi b/app.psgi index 323748d..837dd60 100644 --- a/app.psgi +++ b/app.psgi @@ -1,6 +1,6 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use v5.14; -no if $] >= 5.017011, warnings => 'experimental::smartmatch'; +use warnings; use Gruntmaster::Data; use Plack::App::Gruntmaster; @@ -8,8 +8,6 @@ use Plack::Builder; use Plack::Util; use Log::Log4perl; -use constant AUTH_TIMEOUT => 5 * 60; - sub CONTENT_SECURITY_POLICY () { my $csp = <($_[0]); my $hdrs = Plack::Util::headers($resp->[1]); $hdrs->set('Content-Security-Policy', CONTENT_SECURITY_POLICY); - $hdrs->set('Link', '; rel=stylesheet') if $hdrs->get('Content-Type') =~ m,^text/html,; + $hdrs->set('Cache-Control', 'public, max-age=604800') if $_[0]->{PATH_INFO} =~ qr,^/static/,; $resp->[1] = $hdrs->headers; $resp; } @@ -56,6 +54,7 @@ builder { enable_if { $_[0]->{PATH_INFO} eq '/ok' } sub { sub{ [200, [], []] }}; enable 'ContentLength'; enable \&add_headers; + enable 'Static', path => qr,^/static/,; enable 'Log4perl', category => 'plack'; enable \&add_database; enable '+Plack::App::Gruntmaster::Auth',