removed get method from /api/change

This commit is contained in:
2000-Trek 2023-12-02 18:14:34 +01:00
parent 3832282101
commit f927a70f60
2 changed files with 4 additions and 7 deletions

View file

@ -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"<p>{i[0]} userid: {i[1]} {i[2]} {i[3]} to {i[4]}</p>"
text = text + f'<form action /api/<p style="display: inline;">{i[0]} userid: {i[1]} {i[2]} {i[3]} to {i[4]}</p>'
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 != []:

View file

@ -24,7 +24,7 @@
{"mode":"balance", "username":"{username}", "balance":"{balance}"}
</p>
<br></br>
<p>http://matekasse.server.c3h/api/change</p>
<p>http://matekasse.server.c3h/api/balance</p>
<p>Post method "id" = user id, "change"=change</p>
<p>
If change = None or NaN the change will be -1