From 6914a75f6ce9ed5cb07a640c47681f9df581a472 Mon Sep 17 00:00:00 2001 From: 2000-Trek Date: Sat, 25 Nov 2023 18:26:47 +0100 Subject: [PATCH] ct --- Website/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Website/__init__.py b/Website/__init__.py index 5b1726e..34dabbc 100644 --- a/Website/__init__.py +++ b/Website/__init__.py @@ -306,11 +306,11 @@ def create_app(test_config=None): leave_room(session[id]) #api - @app.route("/api/change", methods=['GET']) + @app.route("/api/change", methods=['POST']) def api_change(): db = get_db() c = db.cursor() - userid = request.args.get("id") + userid = request.form["id"] c.execute("SELECT * FROM users WHERE id=?", [userid]) user_list = c.fetchall() if user_list != []: @@ -318,7 +318,7 @@ def create_app(test_config=None): try: change = int(request.args.get("change")) except: - change = -1 + change = -1.5 c.execute(f"UPDATE users SET balance = balance + {change*100} WHERE id={user[0]}") db.commit() c.execute(f"SELECT * FROM users WHERE id = {userid}") @@ -393,7 +393,7 @@ def create_app(test_config=None): user = c.fetchone() log(type="balance", userid=user[0], before=balance_old, after=user[2]) socketio.emit("update", "update") - return make_response(json.dumps({"mode":"balance", "username":user[1], "balance":user[2]})) + return make_response(json.dumps({"mode":"balance", "username":user[1], "balance":user[2]/100})) else: return make_response(json.dumps({"mode":"error", "error":"043"})) socketio.emit("update", "update")