stop blank messages from being sent #5
19
main
19
main
|
@ -172,7 +172,7 @@ def chatlistrooms():
|
||||||
"name": room["roomname"]
|
"name": room["roomname"]
|
||||||
}
|
}
|
||||||
template.append(roomtemplate)
|
template.append(roomtemplate)
|
||||||
|
|
||||||
return(template), 200
|
return(template), 200
|
||||||
|
|
||||||
@app.route("/api/chat/getmessages/<roomid>")
|
@app.route("/api/chat/getmessages/<roomid>")
|
||||||
|
@ -196,7 +196,7 @@ def chatget(roomid):
|
||||||
"created": message["created"]
|
"created": message["created"]
|
||||||
}
|
}
|
||||||
template.append(messagetemplate)
|
template.append(messagetemplate)
|
||||||
|
|
||||||
return(template), 200
|
return(template), 200
|
||||||
|
|
||||||
burgerMessageUpdate = True
|
burgerMessageUpdate = True
|
||||||
|
@ -223,13 +223,10 @@ def chatsend(roomid):
|
||||||
}, 403
|
}, 403
|
||||||
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
if not content.isspace():
|
conn.execute("INSERT INTO chatmessages (content, chatroom_id, creator, created) VALUES (?, ?, ?, ?)",
|
||||||
conn.execute("INSERT INTO chatmessages (content, chatroom_id, creator, created) VALUES (?, ?, ?, ?)",
|
|
||||||
(content, roomid, userCookie["id"], str(time.time())))
|
(content, roomid, userCookie["id"], str(time.time())))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
else:
|
|
||||||
# do something
|
|
||||||
|
|
||||||
global burgerMessageCache
|
global burgerMessageCache
|
||||||
global burgerMessageUpdate
|
global burgerMessageUpdate
|
||||||
|
@ -335,7 +332,7 @@ def apifrontpage():
|
||||||
},
|
},
|
||||||
"comments": comments
|
"comments": comments
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append(mainthing)
|
result.append(mainthing)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -425,7 +422,7 @@ def apipost():
|
||||||
return {
|
return {
|
||||||
"error": "invalid file format"
|
"error": "invalid file format"
|
||||||
}, 403
|
}, 403
|
||||||
|
|
||||||
filename = secure_filename(file.filename)
|
filename = secure_filename(file.filename)
|
||||||
finalfilename = secrets.token_hex(64) + filename
|
finalfilename = secrets.token_hex(64) + filename
|
||||||
|
|
||||||
|
@ -525,7 +522,7 @@ def comment():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
uid = data["id"]
|
uid = data["id"]
|
||||||
title = data["title"]
|
title = data["title"]
|
||||||
|
|
||||||
userCookie = get_session(usersession)
|
userCookie = get_session(usersession)
|
||||||
user = get_user(userCookie["id"])
|
user = get_user(userCookie["id"])
|
||||||
|
|
||||||
|
|
Reference in New Issue