X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FPlack%2FApp%2FGruntmaster.pm;h=f091892c75364acab62bec77a11defab31818a61;hb=5251db546cbc5eb678a007cfee54d170ad29ff45;hp=77a8828aab25fc687a9876ee9169cd5a68612ed5;hpb=c22928ed23e4213faf2529bde153a5c48e8f3629;p=gruntmaster-page.git diff --git a/lib/Plack/App/Gruntmaster.pm b/lib/Plack/App/Gruntmaster.pm index 77a8828..f091892 100644 --- a/lib/Plack/App/Gruntmaster.pm +++ b/lib/Plack/App/Gruntmaster.pm @@ -137,6 +137,7 @@ sub dispatch_request{ my ($r) = @_; return $r if ref $r ne 'Plack::App::Gruntmaster::Response'; my @hdrs = ('X-Forever' => 1, 'Cache-Control' => "$privacy, max-age=$r->{maxage}"); + push @hdrs, Vary => 'Authorization' if $privacy eq 'private'; return [200, ['Content-Type' => 'application/json', @hdrs], [encode_json $r->{params}]] if $format eq 'json'; my $ret = render $r->{template}, 'en', title => $r->{title}, %{$r->{params}}; [200, ['Content-Type' => 'text/html', @hdrs], [encode 'UTF-8', $ret]] @@ -239,9 +240,10 @@ sub dispatch_request{ my $source = $prog ? read_file $prog->path : $_{source_code}; unlink $prog->path if $prog; + my $private = (problem->private && !$_{contest}) ? 1 : 0; my $newjob = db->jobs->create({ maybe contest => $_{contest}, - maybe private => problem->private && !$_{contest}, + private => $private, date => time, extension => FORMAT_EXTENSION->{$_{prog_format}}, format => $_{prog_format},