remotes/1693045480750635534/spooky-22
Aevann1 2021-10-01 08:34:09 +02:00
parent f4175244e5
commit 88ca58e1de
3 changed files with 8 additions and 15 deletions

View File

@ -1,3 +1,4 @@
from _typeshed import Self
from flask import render_template, g
from sqlalchemy import *
from sqlalchemy.orm import relationship, deferred
@ -365,14 +366,6 @@ class Submission(Base):
if self.url: return self.url.lower().endswith('.webp') or self.url.lower().endswith('.jpg') or self.url.lower().endswith('.png') or self.url.lower().endswith('.gif') or self.url.lower().endswith('.jpeg') or self.url.lower().endswith('?maxwidth=9999')
else: return False
@property
@lazy
def is_video(self) -> bool:
if self.url:
return self.url.startswith("https://i.imgur.com") and self.url.lower().endswith('.mp4')
else:
return False
@property
@lazy
def active_flags(self): return self.flags.count()

View File

@ -80,7 +80,7 @@
<meta property="og:author" name="author" content="{{'@'+comment_info.author.username}}" />
<meta property="og:title" content="{{'@'+comment_info.author.username}} comments on {{p.title}} - {{'SITE_NAME' | app_config}}" />
<meta property="og:image" content="{% if p.is_image %}{{p.realurl(v)}}{% elif p.has_thumb%}{{p.thumb_url}}{% else %}{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp{% endif %}" />
{% if p.is_video %}
{% if p..url.lower().endswith('.mp4') %}
<meta property="og:video" content="{{ p.realurl(v) }}" />
{% endif %}
<meta property="og:url" content="{{comment_info.permalink | full_link}}" />
@ -109,7 +109,7 @@
<meta property="og:author" name="author" content="{{'@'+p.author.username}}" />
<meta property="og:title" content="{{p.title}} - {{'SITE_NAME' | app_config}}" />
<meta property="og:image" content="{% if p.is_image %}{{p.realurl(v)}}{% elif p.has_thumb%}{{p.thumb_url}}{% else %}{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.webp{% endif %}" />
{% if p.is_video %}
{% if p..url.lower().endswith('.mp4') %}
<meta property="og:video" content="{{ p.realurl(v) }}" />
{% endif %}
<meta property="og:url" content="{{p.permalink | full_link}}" />
@ -316,7 +316,7 @@
<iframe loading="lazy" src="{{streamurl}}" width="100%" height="80" frameBorder="0" allowtransparency="true" allow="encrypted-media"></iframe>
<pre></pre>
{% elif not p.embed_url and not p.is_image and not p.is_video %}
{% elif not p.embed_url and not p.is_image and not p..url.lower().endswith('.mp4') %}
<a rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}" {% if not v or v.newtabexternal %}target="_blank"{% endif %}>
<div class="d-flex d-md-none justify-content-between align-items-center border rounded p-2{% if p.realbody(v) %} mb-3{% endif %}">
<span>{{p.domain|truncate(30, True)}}</span>
@ -335,7 +335,7 @@
</div>
</div>
<pre></pre>
{% elif p.is_video %}
{% elif p..url.lower().endswith('.mp4') %}
<div class="row no-gutters">
<div class="col">
<video controls preload="metadata" style="max-width: 100%">
@ -521,7 +521,7 @@
</div>
{% if not p.is_image and not p.is_video %}
{% if not p.is_image and not p..url.lower().endswith('.mp4') %}
<div class="row no-gutters d-md-none">
<div class="col">
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}"></a>

View File

@ -102,7 +102,7 @@
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#expandImageModal" data-bs-url="{{p.realurl(v)}}" onclick="expandDesktopImage('{{ p.realurl(v) }}')">
<img loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
{% elif p.is_video or (p.embed_url and "youtu" in p.domain) or (p.url and "streamable.com/e/" in p.url) %}
{% elif p..url.lower().endswith('.mp4') or (p.embed_url and "youtu" in p.domain) or (p.url and "streamable.com/e/" in p.url) %}
<a href="javascript:void(0)" onclick="document.getElementById('video-{{p.id}}').classList.toggle('d-none')">
<img loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
@ -443,7 +443,7 @@
</div>
{% endif %}
{% if p.is_video %}
{% if p..url.lower().endswith('.mp4') %}
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %}d-none{% endif %} mt-4">
<video controls preload="metadata" style="max-width: 100%">
<source src="{{p.realurl(v)}}" type="video/mp4">