diff options
Diffstat (limited to '')
| -rw-r--r-- | snekbox/nsjail.py (renamed from snekbox.py) | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/snekbox.py b/snekbox/nsjail.py index 65fc4b3..458a94e 100644 --- a/snekbox.py +++ b/snekbox/nsjail.py @@ -2,11 +2,9 @@ import os import subprocess import sys -from flask import Flask, jsonify, render_template, request - -class Snekbox: - """Core snekbox functionality, providing safe execution of Python code.""" +class NsJail: + """Core Snekbox functionality, providing safe execution of Python code.""" def __init__(self, nsjail_binary='nsjail', @@ -95,39 +93,3 @@ class Snekbox: return 'unknown error, no error code' return output - - -snekbox = Snekbox() - -# Load app -app = Flask(__name__) -app.use_reloader = False - -# Logging -log = app.logger - - [email protected]('/') -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 = snekbox.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 = snekbox.python3(body["code"]) - return jsonify(input=body["code"], output=output) |