the comma shit is gonna be the death of me

master
Aevann 2024-10-23 18:06:04 +03:00
parent c41d4757a4
commit 6f12803c00
13 changed files with 40 additions and 40 deletions

View File

@ -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)

View File

@ -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!")

View File

@ -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:

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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!")

View File

@ -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!")

View File

@ -16,7 +16,7 @@
<form id="chat-custom-css" action="/chat/{{chat.id}}/custom_css" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<textarea autocomplete="off" class="form-control rounded" id="css-textarea" placeholder="Custom CSS" rows="3" name="css" form="chat-custom-css" maxlength="{{CSS_LENGTH_LIMIT}}">{% if chat.css %}{{chat.css}}{% endif %}</textarea>
<small>Limit of {{CSS_LENGTH_LIMIT}} characters</small>
<small>Limit of {{CSS_LENGTH_LIMIT | commas}} characters</small>
<div class="d-flex mt-2">
<input autocomplete="off" id="submit-btn" class="btn btn-primary ml-auto" type="submit" value="Save">
</div>

View File

@ -53,7 +53,7 @@
<form id="sidebar" action="/h/{{hole}}/sidebar" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<textarea autocomplete="off" maxlength="10000" class="form-control rounded dont-resize" id="hole-sidebar" placeholder="Enter sidebar here..." rows="10" name="sidebar" form="sidebar">{% if hole.sidebar %}{{hole.sidebar}}{% endif %}</textarea>
<small>Limit of {{HOLE_SIDEBAR_COLUMN_LENGTH}} characters</small>
<small>Limit of {{HOLE_SIDEBAR_COLUMN_LENGTH | commas}} characters</small>
<div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save">
</div>
@ -69,7 +69,7 @@
<form id="css" action="/h/{{hole}}/css" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<textarea autocomplete="off" maxlength="{{CSS_LENGTH_LIMIT}}" class="form-control rounded dont-resize" id="hole-css" placeholder="Enter css here..." rows="10" name="css" form="css">{% if css %}{{css}}{% endif %}</textarea>
<small>Limit of {{CSS_LENGTH_LIMIT}} characters</small>
<small>Limit of {{CSS_LENGTH_LIMIT | commas}} characters</small>
<div class="d-flex">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save">
</div>
@ -86,7 +86,7 @@
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<textarea autocomplete="off" maxlength="{{HOLE_SNAPPY_QUOTES_LENGTH}}" class="form-control rounded dont-resize" id="hole-snappy" placeholder="Enter Snappy Quotes here..." rows="10" name="snappy_quotes" form="snappy_quotes">{% if snappy_quotes %}{{snappy_quotes}}{% endif %}</textarea>
<small>Separate quotes with <code>[para]</code></small>
<p><small>Limit of {{HOLE_SNAPPY_QUOTES_LENGTH}} characters</small></p>
<p><small>Limit of {{HOLE_SNAPPY_QUOTES_LENGTH | commas}} characters</small></p>
<div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save">
</div>

View File

@ -159,7 +159,7 @@
<small>Hides matching posts from the frontpage and collapses matching comments.</small>
<textarea autocomplete="off" class="form-control rounded my-2" placeholder="Add your own custom content filters."
rows="3" name="filters" form="custom-filter" maxlength="1000">{% if v.custom_filter_list %}{{v.custom_filter_list}}{% endif %}</textarea>
<small>Use a new line for each entry. Limit of 1000 characters.</small>
<small>Use a new line for each entry. Limit of 1,000 characters.</small>
<div class="d-flex">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save Changes">
</div>
@ -190,7 +190,7 @@
<small>Notifies you when specific words or phrases are mentioned.</small>
<textarea autocomplete="off" class="form-control rounded my-2" placeholder="Add your own keyword notifications."
rows="3" name="keyword_notifs" form="keyword-notifs" maxlength="1000">{% if v.keyword_notifs %}{{v.keyword_notifs}}{% endif %}</textarea>
<small>Use a new line for each entry. Limit of 1000 characters.</small>
<small>Use a new line for each entry. Limit of 1,000 characters.</small>
<p class="text-small">Will stop taking effect if you reach 100 unread red notifications.</p>
<div class="d-flex">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save Changes">
@ -214,7 +214,7 @@
<small>Enter things you would like <a href="/id/{{SNAPPY_ID}}" rel="nofollow"><img src="/pp/{{SNAPPY_ID}}">@Snappy</a> to reply to your posts with.</small>
<textarea autocomplete="off" class="form-control rounded my-2" placeholder="Add your own custom Snappy quotes."
rows="3" name="snappy_quotes" form="snappy-quotes" maxlength="{{USER_SNAPPY_QUOTES_LENGTH}}">{% if v.snappy_quotes %}{{v.snappy_quotes}}{% endif %}</textarea>
<small>Separate quotes with <code>[para]</code>. Limit of {{USER_SNAPPY_QUOTES_LENGTH}} characters</small>
<small>Separate quotes with <code>[para]</code>. Limit of {{USER_SNAPPY_QUOTES_LENGTH | commas}} characters</small>
<div class="d-flex">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save Changes">
</div>

View File

@ -12,7 +12,7 @@
<form id="profile-settings-css" action="/settings/css" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<textarea autocomplete="off" class="form-control rounded" id="css-textarea" placeholder="Custom CSS" rows="3" name="css" form="profile-settings-css" maxlength="{{CSS_LENGTH_LIMIT}}">{% if v.css %}{{v.csslazy}}{% endif %}</textarea>
<small>Limit of {{CSS_LENGTH_LIMIT}} characters</small>
<small>Limit of {{CSS_LENGTH_LIMIT | commas}} characters</small>
<div class="d-flex mt-2">
<input autocomplete="off" id="submit-btn" class="btn btn-primary ml-auto" type="submit" value="Save">
</div>
@ -30,7 +30,7 @@
<form id="profile-settings-profilecss" action="/settings/profilecss" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<textarea autocomplete="off" class="form-control rounded" id="profilecss-textarea" placeholder="Custom profile CSS" rows="3" name="profilecss" form="profile-settings-profilecss" maxlength="{{CSS_LENGTH_LIMIT}}">{% if profilecss %}{{profilecss}}{% endif %}</textarea>
<small>Limit of {{CSS_LENGTH_LIMIT}} characters</small>
<small>Limit of {{CSS_LENGTH_LIMIT | commas}} characters</small>
<div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save">
</div>

View File

@ -55,7 +55,7 @@
<small class="form-text text-muted">You can upload images, videos, or audio.</small>
</div>
</div>
<label for="post-text" class="mt-3">Text<i class="fas fa-info-circle text-gray-400 ml-1" data-bs-toggle="tooltip" data-bs-placement="top" title="Uses markdown. Limited to {{POST_BODY_LENGTH_LIMIT(v)}} characters."></i></label>
<label for="post-text" class="mt-3">Text<i class="fas fa-info-circle text-gray-400 ml-1" data-bs-toggle="tooltip" data-bs-placement="top" title="Uses markdown. Limited to {{POST_BODY_LENGTH_LIMIT(v) | commas}} characters."></i></label>
<textarea form="submitform" id="post-text" class="file-ta form-control rounded" placeholder="Optional if you have a link or an image." rows="7" name="body" data-preview="preview" data-nonce="{{g.nonce}}" data-oninput="markdown(this);charLimit('post-text','character-count-submit-text-form');checkForRequired();savetext()" {% if v.longpost %}minlength="280"{% endif %} maxlength="{% if v.bird %}140{% else %}{{POST_BODY_LENGTH_LIMIT(v)}}{% endif %}" required></textarea>
<div class="ghostdiv" style="display:none"></div>
<div class="text-small font-weight-bold mt-1" id="character-count-submit-text-form" style="right: 1rem; bottom: 0.5rem; z-index: 3"></div>