added checks to make sure runs and indexes are numbers #5
This commit is contained in:
parent
37c8e13167
commit
a00d93b632
1 changed files with 10 additions and 1 deletions
|
@ -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/<run_index>")
|
||||
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/<run>/<link_index>")
|
||||
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/<run>/<index>")
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue