master
Aevann1 2021-12-31 14:37:42 +02:00
parent bc3a89c74d
commit 62b713b8c8
4 changed files with 8 additions and 8 deletions

View File

@ -212,14 +212,14 @@ def sanitize(sanitized, noimages=False):
t = params.get('t', params.get('start', [0]))[0]
if isinstance(t, str): t = t.replace('s','')
htmlsource = f'<lite-youtube videoid="{yt_id}" params="controls=0&modestbranding=1'
htmlsource = f'<lite-youtube videoid="{yt_id}" params="autoplay=1&modestbranding=1'
if t: htmlsource += f'&start={t}'
htmlsource += '"></lite-youtube>'
sanitized = sanitized.replace(replacing, htmlsource)
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>')
for i in re.finditer('<p>(https:.*?\.(mp4|webm))</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>')
for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]:

View File

@ -786,7 +786,7 @@ def submit_post(v):
params = parse_qs(urlparse(url).query)
t = params.get('t', params.get('start', [0]))[0]
if isinstance(t, str): t = t.replace('s','')
embed = f'<lite-youtube videoid="{yt_id}" params="controls=0&modestbranding=1'
embed = f'<lite-youtube videoid="{yt_id}" params="autoplay=1&modestbranding=1'
if t: embed += f'&start={t}'
embed += '"></lite-youtube>'
elif app.config['SERVER_NAME'] in domain and "/post/" in url and "context" not in url:

View File

@ -59,7 +59,7 @@ You can use Markdown formatting:
<tr>
<td>Youtube Videos</td>
<td>https://youtube.com/watch?v=3Hecr51ByE4</td>
<td><lite-youtube videoid="3Hecr51ByE4" params="controls=0&modestbranding=1"></lite-youtube></td>
<td><lite-youtube videoid="3Hecr51ByE4" params="autoplay=1&modestbranding=1"></lite-youtube></td>
</tr>
<tr>
<td>Video Files</td>

View File

@ -117,7 +117,7 @@
<meta property="og:author" name="author" content="{{'@'+comment_info.author.username}}" >
<meta property="og:title" content="{{'@'+comment_info.author.username}} comments on {{p.plaintitle(v)}} - {{'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}}/static/assets/images/{{'SITE_NAME' | app_config}}/preview.gif{% endif %}" >
{% if p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm')) %}
{% if p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm') or p.url.lower().endswith('.mov')) %}
<meta property="og:video" content="{{ p.realurl(v) }}" >
{% endif %}
<meta property="og:url" content="{{comment_info.permalink | full_link}}" >
@ -146,7 +146,7 @@
{% if p.author %}<meta property="og:author" name="author" content="{{'@'+p.author.username}}" >{% endif %}
<meta property="og:title" content="{{p.plaintitle(v)}} - {{'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}}/static/assets/images/{{'SITE_NAME' | app_config}}/preview.gif{% endif %}" >
{% if p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm')) %}
{% if p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm') or p.url.lower().endswith('.mov')) %}
<meta property="og:video" content="{{ p.realurl(v) }}" >
{% endif %}
<meta property="og:url" content="{{p.permalink | full_link}}" >
@ -373,7 +373,7 @@
<div id="post-body" class="post-body mt-3">
{% if p.realurl(v) %}
{% if not p.embed_url and not p.is_image and not (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm'))) %}
{% if not p.embed_url and not p.is_image and not (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm') or p.url.lower().endswith('.mov'))) %}
<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>
@ -630,7 +630,7 @@
</div>
{% if not p.is_image and not (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm'))) %}
{% if not p.is_image and not (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm') or p.url.lower().endswith('.mov'))) %}
<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>