From a92561f40a06db8d85b9813b799276167593afa1 Mon Sep 17 00:00:00 2001 From: maaa Date: Mon, 10 Jul 2023 15:01:57 +0200 Subject: [PATCH] bug fixes --- main | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main b/main index e9b6bda..122afa6 100644 --- a/main +++ b/main @@ -159,7 +159,11 @@ def user(pageusername): @app.route("/api/page/", methods=("GET", "POST")) def apipageuser(userid): pageuser = get_user(userid) - addhtml = """ """ + addhtml = """ + + """ if not pageuser == "error": return addhtml + pageuser["htmldescription"] @@ -379,6 +383,9 @@ def post(): flash("File is not an image!") return redirect(url_for("post")) + userCookie = get_session(usersession) + user = get_user(userCookie["id"]) + if not user["banned"] == "0": flash("Your account has been banned. Reason: " + user["banned"]) @@ -390,9 +397,6 @@ def post(): file.save(os.path.join(UPLOAD_FOLDER, finalfilename)) imgurl = "/cdn/" + finalfilename - userCookie = get_session(usersession) - user = get_user(userCookie["id"]) - conn = get_db_connection() conn.execute("INSERT INTO posts (textstr, imageurl, creator, created) VALUES (?, ?, ?, ?)", (title, imgurl, userCookie["id"], str(time.time())))