1
0
Fork 0
forked from bton/matekasse
This commit is contained in:
2000-Trek 2023-06-21 20:01:16 +02:00
parent a5102a9cd7
commit 693f62196e

10
main.py
View file

@ -34,7 +34,7 @@ def exit_handler():
#website #website
@app.route("/") @app.route("/")
def index(): def index():
return '<a href="/list">user and tag list</a> <p>The creator of this website accepts no liability for any linguistic or technical errors!</p>' return '<a href="/list">user and tag list</a> <p>The creator of this website accepts no liability for any linguistic or technical errors!</p><br style="line-height: 500%;"></br><a href="/documentation">Doumentation</a>'
@app.route("/list") @app.route("/list")
def list(): def list():
@ -266,7 +266,7 @@ def get_id():
finished = queue_item finished = queue_item
c.execute(f"SELECT * FROM users WHERE id={user}") c.execute(f"SELECT * FROM users WHERE id={user}")
username = c.fetchall() username = c.fetchall()
return make_response(json({"mode":"2","username":username,"code":"1"})) return make_response(json.dumps({"mode":"2","username":username,"code":"1"}))
elif state == "remove": elif state == "remove":
c.execute(f"SELECT * FROM tags WHERE (tagid = {tag_id} AND userid = {user})") c.execute(f"SELECT * FROM tags WHERE (tagid = {tag_id} AND userid = {user})")
tags = c.fetchall() tags = c.fetchall()
@ -296,8 +296,12 @@ def get_id():
socketio.emit("update", "upfinished = queue_itemdate") socketio.emit("update", "upfinished = queue_itemdate")
return make_response(json.dumps({"mode":"1", "username":user[1], "balance":user[2]})) return make_response(json.dumps({"mode":"1", "username":user[1], "balance":user[2]}))
socketio.emit("update", "update") socketio.emit("update", "update")
return make_response(json.dump({"mode":"0","error":"418"})) return make_response(json.dumps({"mode":"0","error":"418"}))
#Documentation
app.route("/documentation")
def documentation():
return render_template("documentation.html")
def main(): def main():
atexit.register(exit_handler) atexit.register(exit_handler)
socketio.run(app, host='0.0.0.0', port=5000) socketio.run(app, host='0.0.0.0', port=5000)