ojudge

A competitive programming judging platform written in OCaml
git clone git://git.laack.co/ojudge.git
Log | Files | Refs | README

commit 8b7087cc97463e071e91ae40acb58e38519f0278
parent 05d6aca373fa1415ccd4db7cf12f2715a27567d4
Author: Andrew Laack <andrew@laack.co>
Date:   Fri, 13 Nov 2026 21:03:58 -0600

cgi bin ignored

Diffstat:
M.gitignore | 1+
Dcgi-bin/home | 9---------
Dcgi-bin/problems | 10----------
Dcgi-bin/status | 27---------------------------
Dcgi-bin/submit | 36------------------------------------
Dcgi-bin/submit-code | 0
6 files changed, 1 insertion(+), 82 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -34,3 +34,4 @@ setup.log # Local OPAM switch _opam/ +cgi-bin/ diff --git a/cgi-bin/home b/cgi-bin/home @@ -1,9 +0,0 @@ -#!/bin/sh -echo "<h1>Problems</h1>" -echo "" - -PROBLEMS=$(ls /var/lib/ojudge/problems/) - -for PROBLEM in $PROBLEMS; do - echo "<a href=\"problems/$PROBLEM\">$PROBLEM</a><br>" -done diff --git a/cgi-bin/problems b/cgi-bin/problems @@ -1,10 +0,0 @@ -#!/bin/sh - -echo "Content-Type: text/html" -echo - -id=${PATH_INFO##*/} - -echo "<h1>Problem: $id</h1>" -cat "/var/lib/ojudge/problems/$id/problem.html" -echo "<p><a href=\"/cgi-bin/submit/$id\">Submit a solution</a></p>" diff --git a/cgi-bin/status b/cgi-bin/status @@ -1,27 +0,0 @@ -#!/bin/sh -printf 'Content-Type: text/html; charset=utf-8\r\n\r\n' - -sub=${PATH_INFO##*/} -rest=${PATH_INFO%/*} -user=${rest##*/} - -dir=/var/lib/ojudge/submissions/$user/$sub - -[ -d "$dir" ] || { echo "<p>No such submission</p>"; exit 0; } - -show() { - echo "<h2>$1</h2><pre>" - sed 's/&/\&amp;/g; s/</\&lt;/g' "$2" - echo "</pre>" -} - -if [ -e "/var/lib/ojudge/pending-review/$user/$sub" ]; then - echo '<meta http-equiv="refresh" content="3">' - echo "<h1>Submission $sub: pending</h1>" -elif [ -e "$dir/results/results.txt" ]; then - echo "<h1>Submission $sub: judged</h1>" - show Results "$dir/results/results.txt" - [ -s "$dir/results/output.txt" ] && show Output "$dir/results/output.txt" -else - echo "<h1>Submission $sub: no results (judging failed?)</h1>" -fi diff --git a/cgi-bin/submit b/cgi-bin/submit @@ -1,36 +0,0 @@ -#!/bin/sh -printf 'Content-Type: text/html; charset=utf-8\r\n\r\n' - -id=${PATH_INFO##*/} - -cat <<EOF -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Submit code: $id</title> -</head> -<body> - <h1>ojudge, submit code</h1> - <p>Problem: <a href="/cgi-bin/problems/$id">$id</a></p> - <div class="form-container"> - <form id="submit-code" action="/cgi-bin/submit-code/$id" method="post"> - <label for="username">Username</label><br> - <input id="username" name="username" required><br> - - <label for="language">Language</label><br> - <select name="language" id="language"> - <option value="ocaml">OCaml</option> - <option value="c">C</option> - <option value="cpp">C++</option> - </select><br> - - <label for="code">Code</label><br> - <textarea id="code" name="code" rows="20" cols="80" - spellcheck="false" required></textarea><br> - <input type="submit" value="Submit"> - </form> - </div> -</body> -</html> -EOF diff --git a/cgi-bin/submit-code b/cgi-bin/submit-code Binary files differ.