forked from MarseyWorld/MarseyWorld
sfdsdf
parent
8614b7142f
commit
8b398277d1
|
@ -229,22 +229,9 @@ def sanitize(sanitized, noimages=False):
|
|||
htmlsource += '"></lite-youtube>'
|
||||
|
||||
sanitized = sanitized.replace(replacing, htmlsource)
|
||||
|
||||
for i in re.finditer('<a href="(https://streamable\.com/e/.*?)"', sanitized):
|
||||
url = i.group(1)
|
||||
replacing = f'<a href="{url}" rel="nofollow noopener noreferrer" target="_blank">{url}</a>'
|
||||
htmlsource = f'<iframe class="embedvid" loading="lazy" src="{url}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
||||
sanitized = sanitized.replace(replacing, htmlsource)
|
||||
|
||||
for i in re.finditer('<p>(https:.*?\.mp4)</p>', sanitized):
|
||||
sanitized = sanitized.replace(i.group(0), f'<p><video controls preload="metadata" class="embedvid"><source src="{i.group(1)}" type="video/mp4"></video>')
|
||||
|
||||
for i in re.finditer('<a href="(https://open\.spotify\.com/embed/.*?)"', sanitized):
|
||||
url = i.group(1)
|
||||
replacing = f'<a href="{url}" rel="nofollow noopener noreferrer" target="_blank">{url}</a>'
|
||||
htmlsource = f'<iframe src="{url}" class="spotify" frameBorder="0" allowtransparency="true" allow="encrypted-media"></iframe>'
|
||||
sanitized = sanitized.replace(replacing, htmlsource)
|
||||
|
||||
for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]:
|
||||
sanitized = sanitized.replace(rd, "https://old.reddit.com/")
|
||||
|
||||
|
|
|
@ -415,19 +415,7 @@
|
|||
|
||||
<div id="post-body" class="post-body mt-3">
|
||||
{% if p.realurl(v) %}
|
||||
{% if p.url.startswith('https://streamable.com/e/') %}
|
||||
<div style="width: 100%; height: 0px; position: relative; padding-bottom: 56.250%;"><iframe loading="lazy" src="{{p.realurl(v)}}" frameborder="0" width="100%" height="100%" allowfullscreen="" style="width: 100%; height: 100%; position: absolute;"></iframe></div>
|
||||
<pre></pre>
|
||||
{% elif p.domain == 'open.spotify.com' %}
|
||||
{% if "spotify.com/embed/" in p.realurl(v) %}
|
||||
{% set streamurl=p.realurl(v) %}
|
||||
{% else %}
|
||||
{% set streamurl=p.realurl(v).replace("spotify.com", "spotify.com/embed") %}
|
||||
{% endif %}
|
||||
<iframe loading="lazy" src="{{streamurl}}" width="100%" height="160" frameBorder="0" allowtransparency="true" allow="encrypted-media"></iframe>
|
||||
<pre></pre>
|
||||
|
||||
{% elif not p.embed_url and not p.is_image and not (p.url and p.url.lower().endswith('.mp4')) %}
|
||||
{% if not p.embed_url and not p.is_image and not (p.url and 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>
|
||||
|
@ -483,14 +471,8 @@
|
|||
<script src="/assets/js/twitter.js?v=1"></script>
|
||||
{% endif %}
|
||||
<script>document.getElementById('twitter-widget-0').setAttribute('sandbox','')</script>
|
||||
{% elif p.domain in ['youtu.be','youtube.com'] %}
|
||||
{% if 'lite' in p.embed_url %}
|
||||
{{p.embed_url | safe}}
|
||||
{% else %}
|
||||
<div class="embed-responsive embed-responsive-16by9 mb-3">
|
||||
<iframe loading="lazy" src="{{p.embed_url}}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% elif p.domain in ['youtu.be','youtube.com'] and p.embed_url and p.embed_url.startswith('<lite-youtube') %}
|
||||
{{p.embed_url | safe}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -491,17 +491,9 @@
|
|||
<source src="{{p.realurl(v)}}" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
{% elif p.embed_url and p.domain in ['youtu.be','youtube.com'] %}
|
||||
{% elif p.embed_url and p.domain in ['youtu.be','youtube.com'] and p.embed_url.startswith('<lite-youtube') %}
|
||||
<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-3 mb-4">
|
||||
{% if 'lite' in p.embed_url %}
|
||||
{{p.embed_url | safe}}
|
||||
{% else %}
|
||||
<iframe loading="lazy" src="{{p.embed_url}}" frameborder="0" style="max-width:100%;max-height:20rem" width="600" height="337" allow="fullscreen"></iframe>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% elif p.url and p.url.startswith('https://streamable.com/e/') %}
|
||||
<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-3 mb-4">
|
||||
<iframe loading="lazy" src="{{p.url}}" frameborder="0" style="max-width:100%;max-height:20rem" width="600" height="337" allow="fullscreen"></iframe>
|
||||
{{p.embed_url | safe}}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue