X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FPlack%2FApp%2FGruntmaster.pm;h=7a3dc348b065037ae139a111b2494945a85eb747;hb=2beb67b456221a9a56d4354f0f4a5c435f0c3a73;hp=bd8a90469fc79155ff223a18b1b7b8c7e7da2b20;hpb=581a6d30cc891dd4274c19df3ae5f9bfce52bbef;p=plack-app-gruntmaster.git diff --git a/lib/Plack/App/Gruntmaster.pm b/lib/Plack/App/Gruntmaster.pm index bd8a904..7a3dc34 100644 --- a/lib/Plack/App/Gruntmaster.pm +++ b/lib/Plack/App/Gruntmaster.pm @@ -34,6 +34,7 @@ use constant CONTENT_TYPES => +{ pas => 'text/x-pascal', pl => 'text/x-perl', py => 'text/x-python', + rb => 'application/x-ruby', l => 'text/plain', }; @@ -48,6 +49,7 @@ use constant FORMAT_EXTENSION => { PASCAL => 'pas', PERL => 'pl', PYTHON => 'py', + RUBY => 'rb', SBCL => 'l', }; @@ -138,21 +140,20 @@ sub dispatch_request{ sub (/login) { forbid !remote_user; - - my $return = $env->{HTTP_REFERER} // '/'; - [303, ['Set-Cookie' => "username=".remote_user->id, Location => $return], []] + [200, ['Content-Type' => 'text/plain; charset=UTF-8', 'Cache-Control' => 'private, max-age=300', Vary => 'Authorization'], [$env->{REMOTE_USER}]] }, sub (/ct/:contest/log/st) { redirect "/st/$_{contest}" }, sub (/us/) { response us => 'Users', {us => db->user_list} }, sub (/ct/ + ?:owner~) { response ct => 'Contests', db->contest_list(%_) }, - sub (/log/ + ?:contest~&:owner~&:page~&:problem~&:private~) { + sub (/log/ + ?:contest~&:owner~&:page~&:problem~&:private~&:result~) { forbid $_{private}; response log => 'Job list', {%{db->job_list(%_)}, maybe contest => $_{contest},} }, sub (/pb/ + ?:owner~&:contest~&:private~) { forbid $_{private}; + forbid contest && contest->is_pending; response pb => 'Problems', db->problem_list(%_) },