]> iEval git - plack-app-gruntmaster.git/blobdiff - lib/Plack/App/Gruntmaster.pm
Add alerts CSS
[plack-app-gruntmaster.git] / lib / Plack / App / Gruntmaster.pm
index f091892c75364acab62bec77a11defab31818a61..66b5b6eb4843d953d351762a43653d4f8f5cc248 100644 (file)
@@ -47,6 +47,7 @@ use constant FORMAT_EXTENSION => {
        PASCAL => 'pas',
        PERL => 'pl',
        PYTHON => 'py',
+       SBCL => 'l',
 };
 
 use constant NOT_FOUND => [404, ['Content-Type' => 'text/plain'], ['Not found']];
@@ -114,8 +115,11 @@ sub dispatch_request{
                sub (/src/:job) {
                        return NOT_FOUND if !job;
                        my $isowner = remote_user && remote_user->id eq job->rawowner;
-                       forbid !$isowner && (job->private || job->problem->private || job->contest && job->contest->is_running);
-                       my @headers = ('X-Forever' => 1, 'Cache-Control' => 'public, max-age=604800', 'Content-Type' => CONTENT_TYPES->{job->format});
+                       my $private = job->private || job->problem->private || job->contest && job->contest->is_running;
+                       forbid !$isowner && $private;
+                       my $privacy = $private ? 'private' : 'public';
+                       my @headers = ('X-Forever' => 1, 'Cache-Control' => "$privacy, max-age=604800", 'Content-Type' => CONTENT_TYPES->{job->format});
+                       push @headers, (Vary => 'Authorization') if $private;
                        [200, \@headers, [job->source]]
                },
 
@@ -241,6 +245,7 @@ sub dispatch_request{
                        my $source = $prog ? read_file $prog->path : $_{source_code};
                        unlink $prog->path if $prog;
                        my $private = (problem->private && !$_{contest}) ? 1 : 0;
+                       $private = 1 if contest && contest->is_pending;
                        my $newjob = db->jobs->create({
                                maybe contest => $_{contest},
                                private => $private,
This page took 0.025281 seconds and 4 git commands to generate.