remotes/1693045480750635534/spooky-22
Aevann1 2021-10-12 15:42:10 +02:00
parent 8854bfd1c4
commit a75a95fcf8
17 changed files with 27 additions and 67 deletions

View File

@ -266,7 +266,7 @@ class User(Base):
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes * Submission.downvotes)
elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom":

View File

@ -14,9 +14,8 @@ def filter_comment_html(html_text):
for link in links:
href=link.get("href", None)
if not href:
continue
href = link.get("href")
if not href: continue
domain = urlparse(href).netloc
@ -30,7 +29,5 @@ def filter_comment_html(html_text):
bans = [x for x in g.db.query(BannedDomain).options(lazyload('*')).filter(BannedDomain.domain.in_(list(domain_list))).all()]
if bans:
return bans
else:
return []
if bans: return bans
else: return []

View File

@ -166,13 +166,7 @@ def api_comment(v):
if bans:
ban = bans[0]
reason = f"Remove the {ban.domain} link from your comment and try again."
if ban.reason:
reason += f" {ban.reason}"
if any([x.reason==4 for x in bans]):
v.ban(days=30, reason="Digitally malicious content")
if any([x.reason==7 for x in bans]):
v.ban( reason="Sexualizing minors")
if ban.reason: reason += f" {ban.reason}"
return {"error": reason}, 401
existing = g.db.query(Comment).options(lazyload('*')).filter(Comment.author_id == v.id,
@ -590,13 +584,8 @@ def edit_comment(cid, v):
ban = bans[0]
reason = f"Remove the {ban.domain} link from your comment and try again."
if any([x.reason==4 for x in bans]):
v.ban(days=30, reason="Digitally malicious content is not allowed.")
return {"error":"Digitally malicious content is not allowed."}
if ban.reason:
reason += f" {ban.reason}"
if ban.reason: reason += f" {ban.reason}"
if request.headers.get("Authorization"): return {'error': f'A blacklisted domain was used.'}, 400
else: return render_template("comment_failed.html",

View File

@ -199,7 +199,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes * Submission.downvotes)
elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom":
@ -297,7 +297,7 @@ def changeloglist(v=None, sort="new", page=1 ,t="all"):
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes * Submission.downvotes)
elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom":
@ -367,7 +367,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all"):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom":

View File

@ -143,7 +143,7 @@ def post_id(pid, anything=None, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom":
@ -168,7 +168,7 @@ def post_id(pid, anything=None, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom":
@ -217,11 +217,7 @@ def edit_post(pid, v):
reason = f"Remove the {ban.domain} link from your post and try again."
if ban.reason:
reason += f" {ban.reason}"
if any([x.reason==4 for x in bans]):
v.ban(days=30, reason="Digitally malicious content is not allowed.")
abort(403)
return {"error": reason}, 403
p.body = body
@ -536,9 +532,6 @@ def submit_post(v):
domain_obj = get_domain(domain)
if domain_obj:
if domain_obj.reason==4: v.ban(days=30, reason="Digitally malicious content")
elif domain_obj.reason==7: v.ban(reason="Sexualizing minors")
if request.headers.get("Authorization"): return {"error":"ToS violation"}, 400
else: return render_template("submit.html", v=v, error="ToS Violation", title=title, url=url, body=request.values.get("body", "")), 400
elif "twitter.com" in domain:
@ -668,13 +661,7 @@ def submit_post(v):
if bans:
ban = bans[0]
reason = f"Remove the {ban.domain} link from your post and try again."
if ban.reason:
reason += f" {ban.reason}"
if any([x.reason==4 for x in bans]):
v.ban(days=30, reason="Digitally malicious content is not allowed.")
abort(403)
if ban.reason: reason += f" {ban.reason}"
if request.headers.get("Authorization"): return {"error": reason}, 403
else: return render_template("submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403

View File

@ -132,7 +132,7 @@ def searchposts(v):
elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial":
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes)
posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes * Submission.downvotes)
elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom":
@ -235,7 +235,7 @@ def searchcomments(v):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom":

View File

@ -135,8 +135,6 @@ def settings_profile_post(v):
if ban.reason:
reason += f" {ban.reason}"
if any([x.reason==4 for x in bans]):
v.ban(days=30, reason="Digitally malicious content is not allowed.")
return {"error": reason}, 401
if len(bio_html) > 10000: abort(400)

View File

@ -572,7 +572,7 @@ def u_username_comments(username, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom":

View File

@ -63,7 +63,7 @@
</div>
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body bg-danger text-center text-white">
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text"></span>
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
</div>
</div>

View File

@ -63,7 +63,7 @@
</div>
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body bg-danger text-center text-white">
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text"></span>
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
</div>
</div>

View File

@ -3,7 +3,7 @@
{% block pagetitle %}Changelog{% endblock %}
{% block desktopBanner %}
<script src="/assets/js/changelog.js?v=53"></script>
<script src="/assets/js/changelog.js?v=54"></script>
<div class="row" style="overflow: visible;padding-top:5px;">
<div class="col">

View File

@ -26,7 +26,7 @@
{% if v %}
{% include "award_modal.html" %}
<script src="/assets/js/comments_v.js?v=53"></script>
<script src="/assets/js/comments_v.js?v=54"></script>
{% endif %}
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
@ -593,17 +593,6 @@
{% endfor %}
<div class="toast" id="toast-comment-success" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body bg-success text-center text-white">
<i class="fas fa-comment-alt-smile mr-2"></i>Comment posted!
</div>
</div>
<div class="toast" id="toast-comment-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body bg-danger text-center text-white">
<i class="fas fa-exclamation-circle mr-2"></i><span id="comment-error-text"></span>
</div>
</div>
{% if v %}
{% include "gif_modal.html" %}
{% include "emoji_modal.html" %}

View File

@ -69,7 +69,7 @@
{% if v %}
<script>function formkey() {return '{{v.formkey}}';}</script>
<script src="/assets/js/default.js?v=53"></script>
<script src="/assets/js/default.js?v=54"></script>
{% endif %}
@ -343,7 +343,7 @@
</div>
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body bg-danger text-center text-white">
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text"></span>
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
</div>
</div>

View File

@ -259,7 +259,7 @@
</div>
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body bg-danger text-center text-white">
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text"></span>
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
</div>
</div>

View File

@ -147,7 +147,7 @@
</div>
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-body bg-danger text-center text-white">
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text"></span>
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
</div>
</div>

View File

@ -53,7 +53,7 @@
</script>
{% if v %}
<script src="/assets/js/comments_v.js?v=53"></script>
<script src="/assets/js/comments_v.js?v=54"></script>
{% include "award_modal.html" %}
{% include "emoji_modal.html" %}
{% include "gif_modal.html" %}

View File

@ -15,7 +15,7 @@
}
</style>
<script src="/assets/js/userpage.js?v=53"></script>
<script src="/assets/js/userpage.js?v=54"></script>
<title>{{u.username}}'s profile - {{'SITE_NAME' | app_config}}</title>
{% if u.is_private %}
<meta name="robots" content="noindex">