diff --git a/api/main.go b/api/main.go index b334429..637d2ba 100644 --- a/api/main.go +++ b/api/main.go @@ -41,16 +41,17 @@ func Execute(res http.ResponseWriter, req *http.Request) { message.Decode(&inbound) whitelist := []string{ - "python", "python2", "python3", - "ruby", - "javascript", "js", "node", "c", "cpp", "c++", - "go", - "r", - "php", "c#", "csharp", "cs", + "go", + "java", "nasm", "asm", + "javascript", "js", "node", + "php", + "python", "python2", "python3", + "r", + "ruby", } // check if the supplied language is supported diff --git a/docker/execute b/docker/execute index 485b05a..b9f4149 100755 --- a/docker/execute +++ b/docker/execute @@ -50,6 +50,9 @@ case "$lang" in "nasm" | "asm") bin=executor_nasm ;; +"java") + bin=executor_java + ;; *) echo "invalid language" exit @@ -72,6 +75,7 @@ docker run \ -v $dir/executors/r:/executor_r:ro \ -v $dir/executors/php:/executor_php:ro \ -v $dir/executors/nasm:/executor_nasm:ro \ + -v $dir/executors/java:/executor_java:ro \ piston \ runuser \ -l runner \ diff --git a/docker/executors/java b/docker/executors/java new file mode 100755 index 0000000..378f217 --- /dev/null +++ b/docker/executors/java @@ -0,0 +1,5 @@ +cp /*.code . +name=$(cat $1 | grep -Eo 'public class ([A-Za-z0-9]+)' | cut -d' ' -f3) +mv $1 $name.java +timeout -s KILL 10 javac $name.java +timeout -s KILL 3 java $name ${@:3}