diff --git a/selector/webserver.py b/selector/webserver.py index ba77179..2d11542 100644 --- a/selector/webserver.py +++ b/selector/webserver.py @@ -10,11 +10,7 @@ from clients.webclients import Client, CLIENTS from flask import Flask, render_template, request, redirect, session from tasks import tasks -from selector.temp_config import CONFIGS, URLS - -BIOGAMES_HOST = "http://biogames.potato.kinf.wiai.uni-bamberg.de" -#BIOGAMES_HOST = "http://www.biodiv2go.de" -RESULT_HOST = "http://results.ma.potato.kinf.wiai.uni-bamberg.de/" +from selector.temp_config import CONFIGS, URLS, HOSTS, RESULT_HOST app = Flask(__name__) clients: typing.Dict[str, Client] = {} @@ -29,9 +25,9 @@ def index(): @app.route("/login", methods=["POST"]) def login(): game = request.form["game"] - if not game in CLIENTS: + if not game in CLIENTS or game not in HOSTS: return redirect("/?invalid_game") - client = CLIENTS[game](host=BIOGAMES_HOST, username=request.form['username'], password=request.form['password']) + client = CLIENTS[game](host=HOSTS[game], username=request.form['username'], password=request.form['password']) if client.login(): session['logged_in'] = True session['uid'] = str(uuid.uuid4())