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:
parent
e5f3d7c829
commit
e41e5c48e8
@ -5,15 +5,14 @@ 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:
|
||||||
ts3conn.login(client_login_name='serveradmin',client_login_password='DE0xWKTx')
|
ts3conn.login(client_login_name='serveradmin', client_login_password='DE0xWKTx')
|
||||||
except ts3.query.TS3QueryError as err:
|
except ts3.query.TS3QueryError as err:
|
||||||
print(err)
|
print(err)
|
||||||
|
|
||||||
@ -25,18 +24,19 @@ def teamspeakClientAdd(clientName):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ts3conn.servergroupaddclient(sgid=9,cldbid=clientdbid)
|
ts3conn.servergroupaddclient(sgid=9, cldbid=clientdbid)
|
||||||
ts3conn.servergroupaddclient(sgid=10,cldbid=clientdbid)
|
ts3conn.servergroupaddclient(sgid=10, cldbid=clientdbid)
|
||||||
ts3conn.servergroupaddclient(sgid=11,cldbid=clientdbid)
|
ts3conn.servergroupaddclient(sgid=11, cldbid=clientdbid)
|
||||||
ts3conn.servergroupaddclient(sgid=12,cldbid=clientdbid)
|
ts3conn.servergroupaddclient(sgid=12, cldbid=clientdbid)
|
||||||
return True
|
return True
|
||||||
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:
|
||||||
ts3conn.login(client_login_name='serveradmin',client_login_password='DE0xWKTx')
|
ts3conn.login(client_login_name='serveradmin', client_login_password='DE0xWKTx')
|
||||||
except ts3.query.TS3QueryError as err:
|
except ts3.query.TS3QueryError as err:
|
||||||
print(err)
|
print(err)
|
||||||
|
|
||||||
@ -51,12 +51,12 @@ def teamspeakClientCheck(clientName):
|
|||||||
except ts3.query.TS3QueryError as ts3err:
|
except ts3.query.TS3QueryError as ts3err:
|
||||||
if ts3err.resp.error['id'] == '512':
|
if ts3err.resp.error['id'] == '512':
|
||||||
session.pop('username', None)
|
session.pop('username', None)
|
||||||
flash("ERROR: Username not found. Type it carefully cos Clockwork PLUS! is gonna cost ya...","danger")
|
flash("ERROR: Username not found. Type it carefully cos Clockwork PLUS! is gonna cost ya...", "danger")
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
return "Ooops! Tell Adam this: <br>" + ts3err.resp.error['msg']
|
return "Ooops! Tell Adam this: <br>" + ts3err.resp.error['msg']
|
||||||
if "9," in groups:
|
if "9," in groups:
|
||||||
print("FeckOffMate!")
|
print("FeckOffMate!")
|
||||||
flash("ERROR: You already have Clockwork PLUS, ya dingus","danger")
|
flash("ERROR: You already have Clockwork PLUS, ya dingus", "danger")
|
||||||
session.pop('username', None)
|
session.pop('username', None)
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
else:
|
else:
|
||||||
@ -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,12 +86,13 @@ 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:
|
||||||
if teamspeakClientAdd(session['username']):
|
if teamspeakClientAdd(session['username']):
|
||||||
session.pop('username', None)
|
session.pop('username', None)
|
||||||
flash("Success! You have been upgraded to Clockwork PLUS! Enjoy!","success")
|
flash("Success! You have been upgraded to Clockwork PLUS! Enjoy!", "success")
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
else:
|
else:
|
||||||
return "Adam fucked up! go nag him"
|
return "Adam fucked up! go nag him"
|
||||||
@ -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__':
|
|
||||||
app.run(host='0.0.0.0',debug=True)
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(host='0.0.0.0', debug=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user