add missing updates to selector

laptop_master
Clemens Klug 2018-06-11 16:08:45 +02:00
parent 79b379e267
commit 465ee6f9ce
1 changed files with 3 additions and 7 deletions

View File

@ -10,11 +10,7 @@ from clients.webclients import Client, CLIENTS
from flask import Flask, render_template, request, redirect, session from flask import Flask, render_template, request, redirect, session
from tasks import tasks from tasks import tasks
from selector.temp_config import CONFIGS, URLS from selector.temp_config import CONFIGS, URLS, HOSTS, RESULT_HOST
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/"
app = Flask(__name__) app = Flask(__name__)
clients: typing.Dict[str, Client] = {} clients: typing.Dict[str, Client] = {}
@ -29,9 +25,9 @@ def index():
@app.route("/login", methods=["POST"]) @app.route("/login", methods=["POST"])
def login(): def login():
game = request.form["game"] game = request.form["game"]
if not game in CLIENTS: if not game in CLIENTS or game not in HOSTS:
return redirect("/?invalid_game") 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(): if client.login():
session['logged_in'] = True session['logged_in'] = True
session['uid'] = str(uuid.uuid4()) session['uid'] = str(uuid.uuid4())