forked from MarseyWorld/MarseyWorld
constantify comment body length limit and transfer limit
parent
b96d6a1ccb
commit
8ea52ba95c
|
@ -265,6 +265,8 @@ POST_TITLE_LENGTH_LIMIT = 500 # do not make larger than 500 without altering the
|
||||||
POST_TITLE_HTML_LENGTH_LIMIT = 1500 # do not make larger than 1500 without altering the table
|
POST_TITLE_HTML_LENGTH_LIMIT = 1500 # do not make larger than 1500 without altering the table
|
||||||
POST_BODY_LENGTH_LIMIT = 20000 # do not make larger than 20000 without altering the table
|
POST_BODY_LENGTH_LIMIT = 20000 # do not make larger than 20000 without altering the table
|
||||||
POST_BODY_HTML_LENGTH_LIMIT = 40000 # do not make larger than 40000 without altering the table
|
POST_BODY_HTML_LENGTH_LIMIT = 40000 # do not make larger than 40000 without altering the table
|
||||||
|
COMMENT_BODY_LENGTH_LIMIT = 10000 # do not make larger than 10000 characters without altering the table
|
||||||
|
TRANSFER_MESSAGE_LENGTH_LIMIT = 200 # do not make larger than 10000 characters (comment limit) without altering the table
|
||||||
|
|
||||||
LOGGEDIN_ACTIVE_TIME = 15 * 60
|
LOGGEDIN_ACTIVE_TIME = 15 * 60
|
||||||
PFP_DEFAULT_MARSEY = True
|
PFP_DEFAULT_MARSEY = True
|
||||||
|
|
|
@ -169,7 +169,7 @@ def comment(v):
|
||||||
|
|
||||||
body = request.values.get("body", "").strip().replace('','')
|
body = request.values.get("body", "").strip().replace('','')
|
||||||
|
|
||||||
body = body.replace('\r\n', '\n')[:10000]
|
body = body.replace('\r\n', '\n')[:COMMENT_BODY_LENGTH_LIMIT]
|
||||||
|
|
||||||
if parent_post.id not in ADMIGGERS:
|
if parent_post.id not in ADMIGGERS:
|
||||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
||||||
|
|
|
@ -275,7 +275,7 @@ def transfer_coins(v, username):
|
||||||
notif_text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount-tax} coins!"
|
notif_text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount-tax} coins!"
|
||||||
|
|
||||||
if reason:
|
if reason:
|
||||||
if len(reason) > 200: return {"error": "Reason is too long, max 200 characters"},400
|
if len(reason) > TRANSFER_MESSAGE_LENGTH_LIMIT: return {"error": f"Reason is too long, max {TRANSFER_MESSAGE_LENGTH_LIMIT} characters"},400
|
||||||
notif_text += f"\n\n> {reason}"
|
notif_text += f"\n\n> {reason}"
|
||||||
log_message += f"\n\n> {reason}"
|
log_message += f"\n\n> {reason}"
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ def message2(v, username):
|
||||||
@auth_required
|
@auth_required
|
||||||
def messagereply(v):
|
def messagereply(v):
|
||||||
body = request.values.get("body", "").strip().replace('','')
|
body = request.values.get("body", "").strip().replace('','')
|
||||||
body = body.replace('\r\n', '\n')[:10000]
|
body = body.replace('\r\n', '\n')[:COMMENT_BODY_LENGTH_LIMIT]
|
||||||
|
|
||||||
if not body and not request.files.get("file"): return {"error": "Message is empty!"}, 400
|
if not body and not request.files.get("file"): return {"error": "Message is empty!"}, 400
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue