1
0
mirror of https://github.com/Adam-Ant/ClockworkAprilFools2017 synced 2024-12-20 11:04:35 +00:00

Format webinterface.py

This commit is contained in:
Joe Groocock 2017-03-31 21:11:09 +01:00
parent e5f3d7c829
commit e41e5c48e8
Signed by untrusted user: frebib
GPG Key ID: E0B16BEACFBB6A86

View File

@ -5,11 +5,10 @@ import ts3
pp = pprint.PrettyPrinter(indent=4) pp = pprint.PrettyPrinter(indent=4)
app = Flask(__name__) app = Flask(__name__)
app.secret_key = rand(24) app.secret_key = rand(24)
def teamspeakClientAdd(clientName): def teamspeakClientAdd(clientName):
with ts3.query.TS3Connection('magic.adam-ant.co.uk', '10011') as ts3conn: with ts3.query.TS3Connection('magic.adam-ant.co.uk', '10011') as ts3conn:
try: try:
@ -33,6 +32,7 @@ def teamspeakClientAdd(clientName):
except: except:
print("ERROR") print("ERROR")
def teamspeakClientCheck(clientName): def teamspeakClientCheck(clientName):
with ts3.query.TS3Connection('magic.adam-ant.co.uk', '10011') as ts3conn: with ts3.query.TS3Connection('magic.adam-ant.co.uk', '10011') as ts3conn:
try: try:
@ -70,6 +70,7 @@ def index():
session.pop('username', None) session.pop('username', None)
return render_template("index.html") return render_template("index.html")
@app.route("/collectsunlight") @app.route("/collectsunlight")
def wait(): def wait():
if "username" in session: if "username" in session:
@ -77,6 +78,7 @@ def wait():
else: else:
return redirect(url_for("buy")) return redirect(url_for("buy"))
@app.route("/pay") @app.route("/pay")
def payment(): def payment():
if "username" in session: if "username" in session:
@ -84,6 +86,7 @@ def payment():
else: else:
return redirect(url_for("buy")) return redirect(url_for("buy"))
@app.route("/activate") @app.route("/activate")
def activate(): def activate():
if "username" in session: if "username" in session:
@ -104,6 +107,6 @@ def buy():
return teamspeakClientCheck(session['username']) return teamspeakClientCheck(session['username'])
return render_template("buy.html") return render_template("buy.html")
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True) app.run(host='0.0.0.0', debug=True)