From f927a70f6058965dd94ff82b36e6c1918e02f43c Mon Sep 17 00:00:00 2001
From: 2000-Trek
Date: Sat, 2 Dec 2023 18:14:34 +0100
Subject: [PATCH] removed get method from /api/change
---
Website/__init__.py | 9 +++------
Website/templates/documentation.html | 2 +-
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/Website/__init__.py b/Website/__init__.py
index 699b1dd..266a535 100644
--- a/Website/__init__.py
+++ b/Website/__init__.py
@@ -108,7 +108,7 @@ def create_app(test_config=None):
c.execute("SELECT * FROM transaction_log ORDER BY ROWID DESC LIMIT 100")
transactionlist = c.fetchall()
for i in transactionlist:
- text = text + f"{i[0]} userid: {i[1]} {i[2]} {i[3]} to {i[4]}
"
+ text = text + f'
'
return text
@app.route("/list/user", methods=['GET'])
@@ -327,14 +327,11 @@ def create_app(test_config=None):
leave_room(session[id])
#api
- @app.route("/api/change", methods=['GET', 'POST'])
+ @app.route("/api/balance", methods=['POST'])
def api_change():
db = get_db()
c = db.cursor()
- try:
- userid = request.form["id"]
- except:
- userid = request.args.get("id")
+ userid = request.form["id"]
c.execute("SELECT * FROM users WHERE id=?", [userid])
user_list = c.fetchall()
if user_list != []:
diff --git a/Website/templates/documentation.html b/Website/templates/documentation.html
index 17f04e1..ccc6024 100644
--- a/Website/templates/documentation.html
+++ b/Website/templates/documentation.html
@@ -24,7 +24,7 @@
{"mode":"balance", "username":"{username}", "balance":"{balance}"}
- http://matekasse.server.c3h/api/change
+ http://matekasse.server.c3h/api/balance
Post method "id" = user id, "change"=change
If change = None or NaN the change will be -1