master
Aevann1 2022-01-14 06:33:09 +02:00
parent 7cbb27a528
commit de641d5879
4 changed files with 5 additions and 5 deletions

View File

@ -247,9 +247,9 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False):
sanitized = sanitized.replace(replacing, htmlsource) sanitized = sanitized.replace(replacing, htmlsource)
for i in re.finditer('>(https://.*?\.(mp4|webm|mov))</a></p>', sanitized): for i in re.finditer('>(https://.*?\.(mp4|webm|mov))</a></p>', sanitized):
sanitized = sanitized.replace(f'<p><a href="{i.group(1)}" rel="nofollow noopener noreferrer" target="_blank">{i.group(1)}</a></p>', f'<p><video controls preload="none" class="embedvid"><source src="{i.group(1)}" type="video/{i.group(2)}"></video>') sanitized = sanitized.replace(f'<p><a href="{i.group(1)}" rel="nofollow noopener noreferrer" target="_blank">{i.group(1)}</a></p>', f'<p><video controls preload="metadata" class="embedvid"><source src="{i.group(1)}" type="video/{i.group(2)}"></video>')
for i in re.finditer('<p>(https:.*?\.(mp4|webm|mov))</p>', sanitized): for i in re.finditer('<p>(https:.*?\.(mp4|webm|mov))</p>', sanitized):
sanitized = sanitized.replace(i.group(0), f'<p><video controls preload="none" class="embedvid"><source src="{i.group(1)}" type="video/{i.group(2)}"></video>') sanitized = sanitized.replace(i.group(0), f'<p><video controls preload="metadata" class="embedvid"><source src="{i.group(1)}" type="video/{i.group(2)}"></video>')
for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it"]: for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it"]:
sanitized = sanitized.replace(rd, "://old.reddit.com") sanitized = sanitized.replace(rd, "://old.reddit.com")

View File

@ -64,7 +64,7 @@ You can use Markdown formatting:
<tr> <tr>
<td>Video Files</td> <td>Video Files</td>
<td>https://files.catbox.moe/v4om92.mp4</td> <td>https://files.catbox.moe/v4om92.mp4</td>
<td><video controls preload="none" class="embedvid"><source src="https://files.catbox.moe/v4om92.mp4" type="video/mp4"></video></td> <td><video controls preload="metadata" class="embedvid"><source src="https://files.catbox.moe/v4om92.mp4" type="video/mp4"></video></td>
</tr> </tr>
<tr> <tr>
<td>Emojis</td> <td>Emojis</td>

View File

@ -429,7 +429,7 @@
{% elif p.is_video %} {% elif p.is_video %}
<div class="row no-gutters"> <div class="row no-gutters">
<div class="col"> <div class="col">
<video controls preload="none" class="embedvid"> <video controls preload="metadata" class="embedvid">
<source src="{{p.realurl(v)}}" type="video/mp4"> <source src="{{p.realurl(v)}}" type="video/mp4">
</video> </video>
</div> </div>

View File

@ -528,7 +528,7 @@
</div> </div>
{% elif p.is_video %} {% 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 environ.get('CARD_VIEW') == '1')) %}d-none{% endif %} mt-4"> <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 id="video2-{{p.id}}" controls preload="none" class="embedvid"> <video id="video2-{{p.id}}" controls preload="metadata" class="embedvid">
<source src="{{p.realurl(v)}}" type="video/mp4"> <source src="{{p.realurl(v)}}" type="video/mp4">
</video> </video>
</div> </div>