Skip to content

Commit

Permalink
Merge pull request #141 from noesya/block-video/handle-peertube
Browse files Browse the repository at this point in the history
Block video : handle peertube
  • Loading branch information
alexisben authored Aug 10, 2023
2 parents 3542380 + e02f3d5 commit c0e225f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion layouts/partials/blocks/templates/video/GetIframe
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
"urls" (slice "dailymotion.com" "dai.ly")
) }}

{{ $providers := slice $vimeo $youtube $dailymotion }}
{{ $peertube := (dict
"name" "peertube"
"urls" (slice "peertube.fr")
) }}

{{ $providers := slice $vimeo $youtube $dailymotion $peertube }}

{{ range $provider := $providers }}
{{ range $provider_url := $provider.urls }}
Expand All @@ -41,6 +46,9 @@
{{ $parts := split $url "video/" }}
{{ $identifier = (index (last 1 $parts) 0) }}
{{ end }}
{{ else if eq $provider.name "peertube" }}
{{ $parts := split $url "w/" }}
{{ $identifier = (index (last 1 $parts) 0) }}
{{ end }}

{{ if $identifier }}
Expand Down
6 changes: 6 additions & 0 deletions layouts/partials/blocks/templates/video/peertube.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<iframe
class="peertube"
src="https://peertube.fr/videos/embed/{{ .id }}"
title="{{ .title }}"
loading="lazy">
</iframe>

0 comments on commit c0e225f

Please sign in to comment.