aboutsummaryrefslogtreecommitdiffstats
path: root/snekbox/site/snekapp.py
diff options
context:
space:
mode:
Diffstat (limited to 'snekbox/site/snekapp.py')
-rw-r--r--snekbox/site/snekapp.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/snekbox/site/snekapp.py b/snekbox/site/snekapp.py
deleted file mode 100644
index 3954238..0000000
--- a/snekbox/site/snekapp.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from flask import Flask, jsonify, render_template, request
-
-from snekbox.nsjail import NsJail
-
-nsjail = NsJail()
-
-# Load app
-app = Flask(__name__)
-app.use_reloader = False
-
-# Logging
-log = app.logger
-
-
-def index():
- """Return a page with a form for inputting code to be executed."""
- return render_template("index.html")
-
-
[email protected]("/result", methods=["POST", "GET"])
-def result():
- """Execute code and return a page displaying the results."""
- if request.method == "POST":
- code = request.form["Code"]
- output = nsjail.python3(code)
- return render_template("result.html", code=code, result=output)
-
-
[email protected]("/input", methods=["POST"])
-def code_input():
- """Execute code and return the results."""
- body = request.get_json()
- output = nsjail.python3(body["code"])
- return jsonify(input=body["code"], output=output)