remotes/1693045480750635534/spooky-22
Aevann1 2021-10-07 01:14:51 +02:00
parent 22638d7dfe
commit 2054987f02
3 changed files with 12 additions and 21 deletions

View File

@ -127,27 +127,21 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
def api_comment(v):
if request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413
parent_submission = request.values.get("submission")
parent_fullname = request.values.get("parent_fullname")
parent_submission = request.values.get("submission").strip()
parent_fullname = request.values.get("parent_fullname").strip()
# get parent item info
parent_id = parent_fullname.split("_")[1]
if parent_fullname.startswith("t2"):
parent_post = get_post(parent_id, v=v)
if parent_post.club and not (v and v.paid_dues): abort(403)
parent_post = get_post(parent_submission, v=v)
if parent_post.club and not (v and v.paid_dues): abort(403)
if parent_fullname.startswith("t2_"):
parent = parent_post
parent_comment_id = None
level = 1
parent_submission = parent_id
elif parent_fullname.startswith("t3"):
parent = get_comment(parent_id, v=v)
elif parent_fullname.startswith("t3_"):
parent = get_comment(parent_fullname.split("_")[1], v=v)
parent_comment_id = parent.id
level = parent.level + 1
parent_id = parent.parent_submission
parent_submission = parent_id
parent_post = get_post(parent_id)
else:
abort(400)
else: abort(400)
#process and sanitize
body = request.values.get("body", "")[:10000]
@ -239,9 +233,6 @@ def api_comment(v):
return {"error": "Too much spam!"}, 403
# create comment
parent_id = parent_fullname.split("_")[1]
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
file=request.files["file"]
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400

View File

@ -319,12 +319,12 @@
{% endif %}
{% if p.realurl(v) %}
<h1 id="post-title" class="card-title post-title text-left mb-md-3"><a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
{% if p.club %}<span class="patron font-weight-bolder" style="background-color:red; font-size:10px; line-height:2;">COUNTRY CLUB</span>{% endif %}
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:10px; line-height:2;">COUNTRY CLUB</span>{% endif %}
{{p.realtitle(v) | safe}}
</a></h1>
{% else %}
<h1 id="post-title" class="card-title post-title text-left mb-md-3">
{% if p.club %}<span class="patron font-weight-bolder" style="background-color:red; font-size:10px; line-height:2;">COUNTRY CLUB</span>{% endif %}
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:10px; line-height:2;">COUNTRY CLUB</span>{% endif %}
{{p.realtitle(v) | safe}}
</h1>
{% endif %}

View File

@ -149,7 +149,7 @@
</div>
<h5 class="card-title post-title text-left w-lg-75 mb-0 pb-0 pb-md-1"><a {% if v and v.newtab %}target="_blank"{% endif %} {% if v %}href="{{p.permalink}}"{% else %}href="/logged_out{{p.permalink}}"{% endif %} class="stretched-link">
{% if p.club %}<span class="patron font-weight-bolder" style="background-color:red; font-size:10px; line-height:2;">COUNTRY CLUB</span>{% endif %}
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:10px; line-height:2;">COUNTRY CLUB</span>{% endif %}
{{p.realtitle(v) | safe}}
</a></h5>