mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
PeerTube: embed videos in post
This commit is contained in:
parent
97d1ba0fbb
commit
1d9c176c7c
2 changed files with 7 additions and 0 deletions
|
@ -999,6 +999,10 @@ class Post(db.Model):
|
|||
if vpos != -1:
|
||||
return self.url[vpos + 2:vpos + 13]
|
||||
|
||||
def peertube_embed(self):
|
||||
if self.url:
|
||||
return self.url.replace('watch', 'embed')
|
||||
|
||||
def profile_id(self):
|
||||
if self.ap_id:
|
||||
return self.ap_id
|
||||
|
|
|
@ -122,6 +122,9 @@
|
|||
<p><a href="https://piped.video/watch?v={{ post.youtube_embed() }}">{{ _('Watch on piped.video') }} <span class="fe fe-external"></span></a></p>
|
||||
<div style="padding-bottom: 56.25%; position: relative;"><iframe style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" src="https://www.youtube.com/embed/{{ post.youtube_embed() }}?rel=0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" width="100%" height="100%" frameborder="0"></iframe></div>
|
||||
{% endif %}
|
||||
{% if 'videos/watch' in post.url %}
|
||||
<div style="padding-bottom: 56.25%; position: relative;"><iframe style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" src="{{ post.peertube_embed() }}" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" width="100%" height="100%" frameborder="0"></iframe></div>
|
||||
{% endif %}
|
||||
{% elif post.type == POST_TYPE_IMAGE %}
|
||||
<div class="post_image">
|
||||
<a href="{{ post.image.view_url() }}" target="_blank" class="post_link" rel="nofollow ugc"><img src="{{ post.image.view_url() }}" alt="{{ post.image.alt_text if post.image.alt_text else post.title }}"
|
||||
|
|
Loading…
Reference in a new issue