diff --git a/watcher/app.py b/watcher/app.py index 6ce918e..8466250 100644 --- a/watcher/app.py +++ b/watcher/app.py @@ -13,7 +13,7 @@ from flask_cors import CORS sio = socketio.Server() app = Flask(__name__) -cors = CORS(app) +CORS(app) app.wsgi_app = socketio.WSGIApp(sio, app.wsgi_app) # We request users to send the run number to prevent accidentially getting old requests from a previous run @@ -38,6 +38,9 @@ def index(): @app.route("/start_run/") def start_run(run_index): + if not run_index.isdigit(): + return f'{run_index} is not a number' + db["current_run"] = run_index starttime = time() if run_index in db["run_data"]: @@ -50,6 +53,9 @@ def start_run(run_index): @app.route("/link/start//") def link_start(run, link_index): + if not run.isdigit() or not link_index.isdigit(): + return f'{run} and/or {link_index} is not a number' + start = time() request_data = live_request(run, link_index) sio.emit('live_request', request_data) @@ -72,6 +78,9 @@ def link_start(run, link_index): @app.route("/link/handoff//") def link_handoff(run, index): + if not run.isdigit() or not index.isdigit(): + return f'{run} and/or {index} is not a number' + if db["current_run"] != run: return "Wrong run number, check that you updated you run", 404 else: