mop up some unnecessary v truthiness
parent
e3473dee47
commit
2bdb382ee5
|
@ -17,7 +17,6 @@ from files.helpers.sorting_and_time import *
|
|||
|
||||
|
||||
def normalize_urls_runtime(body, v):
|
||||
if not v: return body
|
||||
if v.reddit != 'old.reddit.com':
|
||||
body = reddit_to_vreddit_regex.sub(rf'\1https://{v.reddit}/\2/', body)
|
||||
if v.nitter:
|
||||
|
@ -252,7 +251,7 @@ class Comment(Base):
|
|||
if body:
|
||||
body = censor_slurs(body, v)
|
||||
body = normalize_urls_runtime(body, v)
|
||||
if not v or v.controversial:
|
||||
if v.controversial:
|
||||
captured = []
|
||||
for i in controversial_regex.finditer(body):
|
||||
if i.group(1) in captured: continue
|
||||
|
|
|
@ -244,7 +244,7 @@ class Submission(Base):
|
|||
if url.startswith("https://old.reddit.com/r/") and '/comments/' in url and "sort=" not in url:
|
||||
if "?" in url: url += "&context=9"
|
||||
else: url += "?context=8"
|
||||
if not v or v.controversial: url += "&sort=controversial"
|
||||
if v.controversial: url += "&sort=controversial"
|
||||
elif url.startswith("https://watchpeopledie.tv/videos/"):
|
||||
# Semi-temporary fix for self-hosted unproxied video serving
|
||||
url = url.replace("https://watchpeopledie.tv/videos/",
|
||||
|
|
|
@ -806,19 +806,17 @@
|
|||
{% if v %}
|
||||
<script defer src="{{'js/marked.js' | asset}}"></script>
|
||||
<script defer src="{{'js/comments_v.js' | asset}}"></script>
|
||||
{% if v.admin_level >= PERMS['POST_COMMENT_MODERATION_TOOLS_VISIBLE'] %}
|
||||
<script defer src="{{'js/comments_admin.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<script defer src="{{'js/clipboard.js' | asset}}"></script>
|
||||
|
||||
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION_TOOLS_VISIBLE'] %}
|
||||
<script defer src="{{'js/comments_admin.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
<script defer src="{{'js/comments+submission_listing.js' | asset}}"></script>
|
||||
<script defer src="{{'js/comments.js' | asset}}"></script>
|
||||
|
||||
<script>
|
||||
{% if p and (not v or v.highlightcomments) %}
|
||||
{% if p and v.highlightcomments %}
|
||||
comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
|
||||
lastCount = comments['{{p.id}}']
|
||||
if (lastCount)
|
||||
|
@ -903,5 +901,4 @@
|
|||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
</body>
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
{% if not p.is_image and p.thumb_url and not p.embed_url %}
|
||||
<div class="card-header bg-transparent border-0 d-none d-md-flex flex-row flex-nowrap pl-3 p-0">
|
||||
<a rel="nofollow noopener" href="{{p.realurl(v)}}" style="height: fit-content"{% if not v or v.newtabexternal %}target="_blank"{% endif %}><img loading="lazy" src="{{p.thumb_url}}" class="post-img d-mob-none" alt="Unable to load image"></a>
|
||||
<a rel="nofollow noopener" href="{{p.realurl(v)}}" style="height: fit-content"{% if v.newtabexternal %}target="_blank"{% endif %}><img loading="lazy" src="{{p.thumb_url}}" class="post-img d-mob-none" alt="Unable to load image"></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -157,7 +157,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
<span data-bs-toggle="tooltip" data-bs-placement="bottom" id="timestamp" onmouseover="timestamp('timestamp','{{p.created_utc}}')"> {{p.age_string}}</span>
|
||||
({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.is_audio %}audio post{% elif p.domain %}<a href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" class="post-meta-domain" {% if not v or v.newtabexternal %}target="_blank"{% endif %}>{{p.domain|truncate(50, True)}}</a>{% else %}text post{% endif %})
|
||||
({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.is_audio %}audio post{% elif p.domain %}<a href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" class="post-meta-domain" {% if v.newtabexternal %}target="_blank"{% endif %}>{{p.domain|truncate(50, True)}}</a>{% else %}text post{% endif %})
|
||||
|
||||
{% if p.edited_utc %}
|
||||
<span class="ml-2">Edited <span data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('edited_timestamp','{{p.edited_utc}}')" id="edited_timestamp">{{p.edited_string}}</span></span>
|
||||
|
@ -176,7 +176,7 @@
|
|||
{% endif %}
|
||||
{% if p.realurl(v) and not v_forbid_deleted %}
|
||||
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter and p.sub != 'chudrama' %}agendaposter{% endif %}">
|
||||
<a {% if p.author.rainbow %}class="rainbow-text"{% endif %} {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
|
||||
<a {% if p.author.rainbow %}class="rainbow-text"{% endif %} {% if v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
|
||||
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
|
||||
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
|
||||
{{p.realtitle(v) | safe}}
|
||||
|
@ -194,7 +194,7 @@
|
|||
<div id="post-body" class="post-body mt-3">
|
||||
{% if p.realurl(v) %}
|
||||
{% if not p.embed_url and not p.is_image %}
|
||||
<a rel="nofollow noopener" href="{{p.realurl(v)}}" {% if not v or v.newtabexternal %}target="_blank"{% endif %}>
|
||||
<a rel="nofollow noopener" href="{{p.realurl(v)}}" {% if v.newtabexternal %}target="_blank"{% endif %}>
|
||||
<div class="d-flex {% if p.is_video or p.is_audio %}d-md-none{% endif %} justify-content-between align-items-center border rounded p-2 mb-3">
|
||||
<span>{{p.realurl(v)}}</span>
|
||||
<i class="fas fa-external-link-alt text-small"></i>
|
||||
|
@ -222,7 +222,7 @@
|
|||
{% if p.is_image %}
|
||||
<div class="row no-gutters mb-4">
|
||||
<div class="col">
|
||||
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
|
||||
<a {% if v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
|
||||
<img onclick="expandDesktopImage()" src="{{p.realurl(v)}}" class="img-fluid" style="max-height:500px" alt="Unable to load image">
|
||||
</a>
|
||||
</div>
|
||||
|
@ -542,35 +542,27 @@
|
|||
|
||||
</div>
|
||||
|
||||
{% if v and v.id==p.author_id %}
|
||||
{% include "modals/delete_post.html" %}
|
||||
{% endif %}
|
||||
|
||||
{% if v %}
|
||||
{% include "modals/delete_post.html" if v.id == p.author_id %}
|
||||
{% include "modals/report_post.html" %}
|
||||
{% if v.id == p.author_id or v.admin_level >= PERMS['POST_EDITING'] %}
|
||||
<script defer src="{{'js/togglePostEdit.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
{% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
|
||||
<script defer src="{{'js/pinpost.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if v and (v.id == p.author_id or v.admin_level >= PERMS['POST_EDITING']) %}
|
||||
<script defer src="{{'js/togglePostEdit.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if not v or v.highlightcomments %}
|
||||
{% if v.highlightcomments %}
|
||||
<script defer src="{{'js/highlightcomments.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
|
||||
<script defer src="{{'js/pinpost.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
<script defer src="{{'js/clipboard.js' | asset}}"></script>
|
||||
{% include "comments.html" if not p.replies %}
|
||||
|
||||
{% if not p.replies %}
|
||||
{% include "comments.html" %}
|
||||
{% endif %}
|
||||
|
||||
{% if v.highlightcomments %}
|
||||
<script>
|
||||
(() => {
|
||||
{% if not v or v.highlightcomments %}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
showNewCommentCounts('{{p.id}}', {{p.comment_count}})
|
||||
{% if "?context" not in request.full_path %}
|
||||
|
@ -582,9 +574,9 @@
|
|||
localStorage.setItem("comment-counts", JSON.stringify(comments))
|
||||
{% endif %}
|
||||
})
|
||||
{% endif %}
|
||||
})()
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if success %}
|
||||
<script>
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
{% set cc='COUNTRY CLUB' %}
|
||||
{% endif %}
|
||||
|
||||
{% if not v or v.highlightcomments %}
|
||||
{% if v.highlightcomments %}
|
||||
<script defer src="{{'js/highlightcomments.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if v and v.admin_level > 1 %}
|
||||
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
|
||||
<script defer src="{{'js/pinpost.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
|||
<img onclick="toggleyoutube('{{p.id}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
</a>
|
||||
{% else %}
|
||||
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
|
||||
<a {% if v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
|
||||
<img alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
<i class="ext-link fas fa-external-link"></i>
|
||||
</a>
|
||||
|
@ -305,13 +305,13 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if v.highlightcomments %}
|
||||
<script>
|
||||
{% if not v or v.highlightcomments %}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
showNewCommentCounts({{p.id}}, {{p.comment_count}})
|
||||
})
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
|
||||
|
@ -326,22 +326,22 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if p.is_image and not p.over_18 and ((v and v.cardview) or (not v and CARD_VIEW)) %}
|
||||
{% if p.is_image and not p.over_18 and v.cardview %}
|
||||
<div style="text-align: center" class="mt-3 mb-4">
|
||||
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
|
||||
<img loading="lazy" data-src="{{p.realurl(v)}}" src="/i/l.webp" class="img-fluid" style="max-height:20rem" alt="Unable to load image">
|
||||
</a>
|
||||
</div>
|
||||
{% elif p.is_video %}
|
||||
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-4">
|
||||
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not v.cardview %}d-none{% endif %} mt-4">
|
||||
<video id="video2-{{p.id}}" controls preload="none" src="{{p.realurl(v)}}"></video>
|
||||
</div>
|
||||
{% elif p.is_audio %}
|
||||
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-4">
|
||||
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not v.cardview %}d-none{% endif %} mt-4">
|
||||
<audio id="video2-{{p.id}}" controls preload="none" src="{{p.realurl(v)}}"></audio>
|
||||
</div>
|
||||
{% elif p.is_youtube %}
|
||||
<div id="video-{{p.id}}" class="{% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-3 mb-4 youtube_embed">
|
||||
<div id="video-{{p.id}}" class="{% if p.over_18 or not v.cardview %}d-none{% endif %} mt-3 mb-4 youtube_embed">
|
||||
{{p.embed_url | safe}}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue