Aevann 2024-05-23 05:22:20 +03:00
parent 92c0d26f4e
commit 668a7ce2b0
7 changed files with 14 additions and 11 deletions

View File

@ -443,6 +443,8 @@ POST_SORTS = COMMENT_SORTS | {
} }
COMMENT_SORTS = COMMENT_SORTS | {"saves": "save"} COMMENT_SORTS = COMMENT_SORTS | {"saves": "save"}
USER_SNAPPY_QUOTES_LENGTH = 1000
################################################################################ ################################################################################
### COLUMN INFO ### COLUMN INFO
################################################################################ ################################################################################
@ -450,7 +452,7 @@ COMMENT_SORTS = COMMENT_SORTS | {"saves": "save"}
HOLE_NAME_COLUMN_LENGTH = 25 HOLE_NAME_COLUMN_LENGTH = 25
HOLE_SIDEBAR_COLUMN_LENGTH = 10000 HOLE_SIDEBAR_COLUMN_LENGTH = 10000
HOLE_SIDEBAR_HTML_COLUMN_LENGTH = 20000 HOLE_SIDEBAR_HTML_COLUMN_LENGTH = 20000
CUSTOM_SNAPPY_QUOTES_LENGTH = 20000 HOLE_SNAPPY_QUOTES_LENGTH = 50000
HOLE_SIDEBAR_URL_COLUMN_LENGTH = 60 HOLE_SIDEBAR_URL_COLUMN_LENGTH = 60
HOLE_BANNER_URL_COLUMN_LENGTH = 60 HOLE_BANNER_URL_COLUMN_LENGTH = 60
HOLE_MARSEY_URL_LENGTH = 60 HOLE_MARSEY_URL_LENGTH = 60

View File

@ -953,8 +953,8 @@ def post_hole_snappy_quotes(v, hole):
if snappy_quotes.endswith('[para]'): if snappy_quotes.endswith('[para]'):
snappy_quotes = snappy_quotes[:-6].strip() snappy_quotes = snappy_quotes[:-6].strip()
if len(snappy_quotes) > CUSTOM_SNAPPY_QUOTES_LENGTH: if len(snappy_quotes) > HOLE_SNAPPY_QUOTES_LENGTH:
abort(400, f"Quotes are too long (max {CUSTOM_SNAPPY_QUOTES_LENGTH} characters)") abort(400, f"Quotes are too long (max {HOLE_SNAPPY_QUOTES_LENGTH} characters)")
hole.snappy_quotes = snappy_quotes hole.snappy_quotes = snappy_quotes
g.db.add(hole) g.db.add(hole)

View File

@ -206,6 +206,5 @@ def inject_constants():
"CURSORMARSEY_DEFAULT":CURSORMARSEY_DEFAULT, "SNAPPY_ID":SNAPPY_ID, "ZOZBOT_ID":ZOZBOT_ID, "get_running_orgy":get_running_orgy, "CURSORMARSEY_DEFAULT":CURSORMARSEY_DEFAULT, "SNAPPY_ID":SNAPPY_ID, "ZOZBOT_ID":ZOZBOT_ID, "get_running_orgy":get_running_orgy,
"bar_position":bar_position, "datetime":datetime, "CSS_LENGTH_LIMIT":CSS_LENGTH_LIMIT, "cache":cache, "bar_position":bar_position, "datetime":datetime, "CSS_LENGTH_LIMIT":CSS_LENGTH_LIMIT, "cache":cache,
"emoji_count":emoji_count, "group_count":group_count, "user_count":user_count, "emoji_count":emoji_count, "group_count":group_count, "user_count":user_count,
"HOLE_SIDEBAR_COLUMN_LENGTH":HOLE_SIDEBAR_COLUMN_LENGTH, "CUSTOM_SNAPPY_QUOTES_LENGTH":CUSTOM_SNAPPY_QUOTES_LENGTH, "HOLE_SIDEBAR_COLUMN_LENGTH":HOLE_SIDEBAR_COLUMN_LENGTH, "HOLE_SNAPPY_QUOTES_LENGTH":HOLE_SNAPPY_QUOTES_LENGTH, "USER_SNAPPY_QUOTES_LENGTH":USER_SNAPPY_QUOTES_LENGTH, "top_poster_of_the_day":top_poster_of_the_day,
"top_poster_of_the_day":top_poster_of_the_day,
} }

View File

@ -457,8 +457,8 @@ def snappy_quotes(v):
if snappy_quotes == v.snappy_quotes: if snappy_quotes == v.snappy_quotes:
abort(400, "You didn't change anything!") abort(400, "You didn't change anything!")
if len(snappy_quotes) > CUSTOM_SNAPPY_QUOTES_LENGTH: if len(snappy_quotes) > USER_SNAPPY_QUOTES_LENGTH:
abort(400, f"Quotes are too long (max {CUSTOM_SNAPPY_QUOTES_LENGTH} characters)") abort(400, f"Quotes are too long (max {USER_SNAPPY_QUOTES_LENGTH} characters)")
if not snappy_quotes: if not snappy_quotes:
snappy_quotes = None snappy_quotes = None

View File

@ -84,9 +84,9 @@
<div class="w-lg-100"> <div class="w-lg-100">
<form id="snappy_quotes" action="/h/{{hole}}/snappy_quotes" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)"> <form id="snappy_quotes" action="/h/{{hole}}/snappy_quotes" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no"> <input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<textarea autocomplete="off" maxlength="{{CUSTOM_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> <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> <small>Separate quotes with <code>[para]</code></small>
<p><small>Limit of {{CUSTOM_SNAPPY_QUOTES_LENGTH}} characters</small></p> <p><small>Limit of {{HOLE_SNAPPY_QUOTES_LENGTH}} characters</small></p>
<div class="d-flex mt-2"> <div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save"> <input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save">
</div> </div>

View File

@ -213,8 +213,8 @@
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no"> <input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<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> <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." <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="1000">{% if v.snappy_quotes %}{{v.snappy_quotes}}{% endif %}</textarea> 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 {{CUSTOM_SNAPPY_QUOTES_LENGTH}} characters</small> <small>Separate quotes with <code>[para]</code>. Limit of {{USER_SNAPPY_QUOTES_LENGTH}} characters</small>
<div class="d-flex"> <div class="d-flex">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save Changes"> <input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save Changes">
</div> </div>

View File

@ -0,0 +1,2 @@
alter table users alter column snappy_quotes type varchar(1000);
alter table holes alter column snappy_quotes type varchar(50000);