diff --git a/files/routes/admin.py b/files/routes/admin.py index b84cd3931..a6b3efd2c 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -888,7 +888,7 @@ def shadowban(user_id, v): stop(400, "You need to submit a reason for shadowbanning!") if len(reason) > BAN_REASON_LENGTH_LIMIT: - stop(400, f"Shadowban reason is too long (max {BAN_REASON_LENGTH_LIMIT} characters)") + stop(400, f"Shadowban reason is too long (max {commas(BAN_REASON_LENGTH_LIMIT)} characters)") reason = filter_emojis_only(reason) @@ -1029,7 +1029,7 @@ def ban_user(fullname, v): stop(400, "You need to submit a reason for banning!") if len(reason) > BAN_REASON_LENGTH_LIMIT: - stop(400, f"Ban reason is too long (max {BAN_REASON_LENGTH_LIMIT} characters)") + stop(400, f"Ban reason is too long (max {commas(BAN_REASON_LENGTH_LIMIT)} characters)") reason = filter_emojis_only(reason) diff --git a/files/routes/chat.py b/files/routes/chat.py index c367499b7..3087e6d8b 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -388,7 +388,7 @@ def delete(id, v): def messagereply(v): body = request.values.get("body", "").strip() if len(body) > COMMENT_BODY_LENGTH_LIMIT: - stop(400, f'Message is too long (max {COMMENT_BODY_LENGTH_LIMIT} characters)') + stop(400, f'Message is too long (max {commas(COMMENT_BODY_LENGTH_LIMIT)} characters)') id = request.values.get("parent_id") parent = get_comment(id, v=v) @@ -422,7 +422,7 @@ def messagereply(v): if not g.is_tor and get_setting("dm_media"): body = process_files(request.files, v, body, is_dm=True, dm_user=user) if len(body) > COMMENT_BODY_LENGTH_LIMIT: - stop(400, f'Message is too long (max {COMMENT_BODY_LENGTH_LIMIT} characters)') + stop(400, f'Message is too long (max {commas(COMMENT_BODY_LENGTH_LIMIT)} characters)') if not body: stop(400, "Message is empty!") diff --git a/files/routes/chats.py b/files/routes/chats.py index 83ed88877..6a60c376a 100644 --- a/files/routes/chats.py +++ b/files/routes/chats.py @@ -229,7 +229,7 @@ def chat_custom_css_post(v, chat_id): css = request.values.get('css', '').strip() if len(css) > CSS_LENGTH_LIMIT: - stop(400, f"Chat CSS is too long (max {CSS_LENGTH_LIMIT} characters)") + stop(400, f"Chat CSS is too long (max {commas(CSS_LENGTH_LIMIT)} characters)") valid, error = validate_css(css) if not valid: diff --git a/files/routes/comments.py b/files/routes/comments.py index dba1283a5..a3434c467 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -169,7 +169,7 @@ def comment(v): body = request.values.get("body", "").strip() if len(body) > COMMENT_BODY_LENGTH_LIMIT: - stop(400, f'Comment body is too long (max {COMMENT_BODY_LENGTH_LIMIT} characters)') + stop(400, f'Comment body is too long (max {commas(COMMENT_BODY_LENGTH_LIMIT)} characters)') body = body.replace('@jannies', '!jannies') @@ -196,7 +196,7 @@ def comment(v): body = process_files(request.files, v, body, is_badge_thread=is_badge_thread, comment_body=comment_body) if len(body) > COMMENT_BODY_LENGTH_LIMIT: - stop(400, f'Comment body is too long (max {COMMENT_BODY_LENGTH_LIMIT} characters)') + stop(400, f'Comment body is too long (max {commas(COMMENT_BODY_LENGTH_LIMIT)} characters)') if v.admin_level >= PERMS['USE_ADMIGGER_THREADS'] and posting_to_post and post_target.id == SNAPPY_THREAD and level == 1: body = remove_cuniform(body) @@ -709,7 +709,7 @@ def edit_comment(cid, v): body = request.values.get("body", "").strip() if len(body) > COMMENT_BODY_LENGTH_LIMIT: - stop(400, f'Comment body is too long (max {COMMENT_BODY_LENGTH_LIMIT} characters)') + stop(400, f'Comment body is too long (max {commas(COMMENT_BODY_LENGTH_LIMIT)} characters)') if len(body) < 1 and not (request.files.get("file") and not g.is_tor): stop(400, "You have to actually type something!") @@ -727,7 +727,7 @@ def edit_comment(cid, v): body = process_files(request.files, v, body) if len(body) > COMMENT_BODY_LENGTH_LIMIT: - stop(400, f'Comment body is too long (max {COMMENT_BODY_LENGTH_LIMIT} characters)') + stop(400, f'Comment body is too long (max {commas(COMMENT_BODY_LENGTH_LIMIT)} characters)') body_html = sanitize(body, golden=False, limit_pings=5, showmore=(not v.hieroglyphs), commenters_ping_post_id=c.parent_post, obj=c, author=c.author) diff --git a/files/routes/holes.py b/files/routes/holes.py index acb57c20c..20c22481e 100644 --- a/files/routes/holes.py +++ b/files/routes/holes.py @@ -430,7 +430,7 @@ def post_hole_sidebar(v, hole): sidebar = request.values.get('sidebar', '').strip() if len(sidebar) > 10000: - stop(400, "New sidebar is too long (max 10000 characters)") + stop(400, "New sidebar is too long (max 10,000 characters)") sidebar_html = sanitize(sidebar, blackjack=f"/h/{hole} sidebar") @@ -466,7 +466,7 @@ def post_hole_css(v, hole): if v.shadowbanned: stop(400) if len(css) > CSS_LENGTH_LIMIT: - stop(400, f"Hole CSS is too long (max {CSS_LENGTH_LIMIT} characters)") + stop(400, f"Hole CSS is too long (max {commas(CSS_LENGTH_LIMIT)} characters)") valid, error = validate_css(css) if not valid: @@ -955,7 +955,7 @@ def post_hole_snappy_quotes(v, hole): snappy_quotes = snappy_quotes[:-6].strip() if len(snappy_quotes) > HOLE_SNAPPY_QUOTES_LENGTH: - stop(400, f"Quotes are too long (max {HOLE_SNAPPY_QUOTES_LENGTH} characters)") + stop(400, f"Quotes are too long (max {commas(HOLE_SNAPPY_QUOTES_LENGTH)} characters)") hole.snappy_quotes = snappy_quotes g.db.add(hole) diff --git a/files/routes/posts.py b/files/routes/posts.py index 5128d6098..12108a20d 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -475,11 +475,11 @@ def submit_post(v, hole=None): title = request.values.get("title", "").replace('\x00', '').replace('\n', ' ').strip() if len(title) > POST_TITLE_LENGTH_LIMIT: - stop(400, f'Post title is too long (max {POST_TITLE_LENGTH_LIMIT} characters)') + stop(400, f'Post title is too long (max {commas(POST_TITLE_LENGTH_LIMIT)} characters)') body = request.values.get("body", "").replace('\x00', '').strip() if len(body) > POST_BODY_LENGTH_LIMIT(g.v): - stop(400, f'Post body is too long (max {POST_BODY_LENGTH_LIMIT(g.v)} characters)') + stop(400, f'Post body is too long (max {commas(POST_BODY_LENGTH_LIMIT(g.v))} characters)') body = body.replace('@jannies', '!jannies') @@ -590,7 +590,7 @@ def submit_post(v, hole=None): body = process_files(request.files, v, body).strip() if len(body) > POST_BODY_LENGTH_LIMIT(g.v): - stop(400, f'Post body is too long (max {POST_BODY_LENGTH_LIMIT(g.v)} characters)') + stop(400, f'Post body is too long (max {commas(POST_BODY_LENGTH_LIMIT(g.v))} characters)') flag_notify = (request.values.get("notify", "on") == "on") flag_new = request.values.get("new", False, bool) or 'megathread' in title.lower() @@ -1100,11 +1100,11 @@ def edit_post(pid, v): title = request.values.get("title", "").strip() if len(title) > POST_TITLE_LENGTH_LIMIT: - stop(400, f'Post title is too long (max {POST_TITLE_LENGTH_LIMIT} characters)') + stop(400, f'Post title is too long (max {commas(POST_TITLE_LENGTH_LIMIT)} characters)') body = request.values.get("body", "").strip() if len(body) > POST_BODY_LENGTH_LIMIT(g.v): - stop(400, f'Post body is too long (max {POST_BODY_LENGTH_LIMIT(g.v)} characters)') + stop(400, f'Post body is too long (max {commas(POST_BODY_LENGTH_LIMIT(g.v))} characters)') body = body.replace('@jannies', '!jannies') @@ -1156,7 +1156,7 @@ def edit_post(pid, v): body = process_files(request.files, v, body).strip() if len(body) > POST_BODY_LENGTH_LIMIT(g.v): - stop(400, f'Post body is too long (max {POST_BODY_LENGTH_LIMIT(g.v)} characters)') + stop(400, f'Post body is too long (max {commas(POST_BODY_LENGTH_LIMIT(g.v))} characters)') if body != p.body or p.chudded: body_html = sanitize(body, golden=False, limit_pings=100, obj=p, author=p.author) diff --git a/files/routes/settings.py b/files/routes/settings.py index 7b115270b..2eaee6d97 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -268,7 +268,7 @@ def settings_personal_post(v): elif not updated and FEATURES['USERS_PROFILE_BODYTEXT'] and request.values.get("friends"): friends = request.values.get("friends", "").strip() if len(friends) > BIO_FRIENDS_ENEMIES_LENGTH_LIMIT: - stop(400, f'Ypur friend list is too long (max {BIO_FRIENDS_ENEMIES_LENGTH_LIMIT} characters)') + stop(400, f'Ypur friend list is too long (max {commas(BIO_FRIENDS_ENEMIES_LENGTH_LIMIT)} characters)') friends_html = sanitize(friends, blackjack="friends") if len(friends_html) > BIO_FRIENDS_ENEMIES_HTML_LENGTH_LIMIT: @@ -301,7 +301,7 @@ def settings_personal_post(v): elif not updated and FEATURES['USERS_PROFILE_BODYTEXT'] and request.values.get("enemies"): enemies = request.values.get("enemies", "").strip() if len(enemies) > BIO_FRIENDS_ENEMIES_LENGTH_LIMIT: - stop(400, f'You enemy list is too long (max {BIO_FRIENDS_ENEMIES_LENGTH_LIMIT} characters)') + stop(400, f'You enemy list is too long (max {commas(BIO_FRIENDS_ENEMIES_LENGTH_LIMIT)} characters)') enemies_html = sanitize(enemies, blackjack="enemies") if len(enemies_html) > BIO_FRIENDS_ENEMIES_HTML_LENGTH_LIMIT: @@ -335,7 +335,7 @@ def settings_personal_post(v): bio = request.values.get("bio", "").strip() bio = process_files(request.files, v, bio) if len(bio) > BIO_FRIENDS_ENEMIES_LENGTH_LIMIT: - stop(400, f'Your bio is too long (max {BIO_FRIENDS_ENEMIES_LENGTH_LIMIT} characters)') + stop(400, f'Your bio is too long (max {commas(BIO_FRIENDS_ENEMIES_LENGTH_LIMIT)} characters)') bio_html = sanitize(bio, blackjack="bio") if len(bio_html) > BIO_FRIENDS_ENEMIES_HTML_LENGTH_LIMIT: @@ -405,7 +405,7 @@ def filters(v): filters = request.values.get("filters", "").strip() if len(filters) > 1000: - stop(400, "Filters are too long (max 1000 characters)") + stop(400, "Filters are too long (max 1,000 characters)") if filters in {"", "None"}: filters = None @@ -433,7 +433,7 @@ def keyword_notifs(v): stop(400, "You didn't change anything!") if len(keyword_notifs) > 1000: - stop(400, "Keywords are too long (max 1000 characters)") + stop(400, "Keywords are too long (max 1,000 characters)") if not keyword_notifs: keywords_notifs = None @@ -461,7 +461,7 @@ def snappy_quotes(v): stop(400, "You didn't change anything!") if len(snappy_quotes) > USER_SNAPPY_QUOTES_LENGTH: - stop(400, f"Quotes are too long (max {USER_SNAPPY_QUOTES_LENGTH} characters)") + stop(400, f"Quotes are too long (max {commas(USER_SNAPPY_QUOTES_LENGTH)} characters)") if not snappy_quotes: snappy_quotes = None @@ -720,7 +720,7 @@ def settings_css(v): css = request.values.get("css", v.css).strip() if len(css) > CSS_LENGTH_LIMIT: - stop(400, f"CSS is too long (max {CSS_LENGTH_LIMIT} characters)") + stop(400, f"CSS is too long (max {commas(CSS_LENGTH_LIMIT)} characters)") v.css = css g.db.add(v) @@ -736,7 +736,7 @@ def settings_profilecss(v): profilecss = request.values.get("profilecss", v.profilecss).strip() if len(profilecss) > CSS_LENGTH_LIMIT: - stop(400, f"Profile CSS is too long (max {CSS_LENGTH_LIMIT} characters)") + stop(400, f"Profile CSS is too long (max {commas(CSS_LENGTH_LIMIT)} characters)") valid, error = validate_css(profilecss) if not valid: @@ -1026,7 +1026,7 @@ def process_settings_plaintext(kind, current, length, default_value): value = value.lower() if len(value) > length: - stop(400, f"The value you entered exceeds the character limit ({length} characters)") + stop(400, f"The value you entered exceeds the character limit ({commas(length)} characters)") if value == current: stop(400, "You didn't change anything!") diff --git a/files/routes/users.py b/files/routes/users.py index e27f9f38f..eefa49b61 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -186,7 +186,7 @@ def transfer_currency(v, username, currency_name, apply_tax): if reason: if len(reason) > TRANSFER_MESSAGE_LENGTH_LIMIT: - stop(400, f"Reason is too long (max {TRANSFER_MESSAGE_LENGTH_LIMIT} characters)") + stop(400, f"Reason is too long (max {commas(TRANSFER_MESSAGE_LENGTH_LIMIT)} characters)") notif_text += '\n\n> ' + '\n\n> '.join(reason.splitlines()) log_message += '\n\n> ' + '\n\n> '.join(reason.splitlines()) @@ -655,12 +655,12 @@ def message(v, username=None, id=None): body = request.values.get("message", "").strip() if len(body) > COMMENT_BODY_LENGTH_LIMIT: - stop(400, f'Message is too long (max {COMMENT_BODY_LENGTH_LIMIT} characters)') + stop(400, f'Message is too long (max {commas(COMMENT_BODY_LENGTH_LIMIT)} characters)') if not g.is_tor and get_setting("dm_media"): body = process_files(request.files, v, body, is_dm=True, dm_user=user) if len(body) > COMMENT_BODY_LENGTH_LIMIT: - stop(400, f'Message is too long (max {COMMENT_BODY_LENGTH_LIMIT} characters)') + stop(400, f'Message is too long (max {commas(COMMENT_BODY_LENGTH_LIMIT)} characters)') if not body: stop(400, "Message is empty!") diff --git a/files/templates/chat_css.html b/files/templates/chat_css.html index 3608e5fb9..7c11823ff 100644 --- a/files/templates/chat_css.html +++ b/files/templates/chat_css.html @@ -16,7 +16,7 @@