]>
iEval git - gruntmaster-page.git/blob - app.psgi
4 use Apache2
::Authen
::Passphrase qw
/pwcheck/;
5 use Apache2
::AuthzCaps qw
/hascaps/;
7 use Plack
::App
::Gruntmaster
;
11 $Apache2::AuthzCaps
::rootdir
= $Apache2::Authen
::Passphrase
::rootdir
;
12 my $word = qr
,(\w
+),a
;
15 local $Log::Log4perl
::caller_depth
= $Log::Log4perl
::caller_depth
+ 1;
16 $_[0]->{'psgix.logger'}->({qw
/level debug message/ => $_[1]})
19 sub some_auth_required
{
20 my $r = Plack
::Request
->new($_[0]);
21 return 1 if $_[0]->{'gruntmaster.reqadmin'} || $r->path eq '/action/passwd' || $r->path =~ m
,/pb/$word/submit
$,;
27 return 1 if m
,^/pb/$word, && problem_private
$1;
28 return 1 if m
,^/log/(?
:job
|src
)/$word, && job_private
$1;
29 return 1 if m
,^/ct/$word/(?
:pb
|log), && time < contest_start
$1;
30 return 1 if m
,^/ct/$word/log/src
, && time < contest_end
$1;
37 *__ANON__
= "require_admin_middleware";
39 my $r = Plack
::Request
->new($env);
40 $env->{'gruntmaster.reqadmin'} = 1 if admin_required
$r->path;
46 my ($user, $pass, $env) = @_;
52 return if $env->{'gruntmaster.reqadmin'} && !hascaps
$user, 'gmadm';
57 enable
'ContentLength';
58 enable_if
{ $_[0]->{PATH_INFO
} =~ qr
,^/static/,} Header
=> set
=> ['Cache-Control', 'public, max-age=604800'];
59 enable
'Static', path
=> qr
,^/static/,;
60 enable
'Log4perl', category
=> 'plack', conf
=> 'log.conf';
61 enable \
&require_admin
;
62 enable_if \
&some_auth_required
, 'Auth::Basic', authenticator
=> \
&authenticate
, realm
=> 'Gruntmaster 6000';
63 Plack
::App
::Gruntmaster
->to_app
This page took 0.056671 seconds and 4 git commands to generate.