diff --git a/content/licenca.md b/content/licenca.md index 138e1dc..6e7ba64 100644 --- a/content/licenca.md +++ b/content/licenca.md @@ -11,6 +11,7 @@ O tema do website foi baseado no [Academic](https://themes.gohugo.io/themes/hugo Utilizamos as seguintes bibliotecas: - [fuse.js](https://fusejs.io), disponível sob a [licença Apache 2.0](https://github.com/krisk/Fuse/blob/master/LICENSE) - [mark.js](https://markjs.io), disponível sob a [licença MIT](https://github.com/julmot/mark.js/blob/master/LICENSE) +- [hugo-peertube-shortcode](https://codeberg.org/_aris/hugo-peertube-shortcode), disponível sob a [licença MIT](https://codeberg.org/_aris/hugo-peertube-shortcode/src/commit/10197c1b4bc15c375d51a5c9da76c6b2ee7055da/LICENSE) ## Ícones diff --git a/themes/academic/layouts/shortcodes/peertube.html b/themes/academic/layouts/shortcodes/peertube.html new file mode 100644 index 0000000..f88b4aa --- /dev/null +++ b/themes/academic/layouts/shortcodes/peertube.html @@ -0,0 +1,102 @@ +{{/* Get parameters from shortcode call. */}} +{{ $host := "" }} +{{ $id := "" }} + +{{ if .IsNamedParams -}} + {{ $host = (.Get "host") }} + {{ $id = (.Get "id") }} +{{- else -}} + {{ $host = (.Get 0) }} + {{ $id = (.Get 1) }} +{{- end }} + +{{/* Fetch a local copy of the videos preview image. */}} +{{ $videoinfo := dict }} +{{ $path := path.Join $host "api" "v1" "videos" $id }} +{{ $endpoint := print "https://" $path }} +{{ with resources.GetRemote $endpoint }} + {{ with .Err }} + {{ errorf "%s" . }} + {{ else }} + {{ $videoinfo = . | transform.Unmarshal }} + {{ end }} +{{ else }} + {{ errorf "Unable to get remote resource %q" $endpoint }} +{{ end }} +{{ $url := print "https://" $host $videoinfo.previewPath }} +{{ $img := resources.GetRemote $url }} +{{ $destination := path.Join (.Page.RelPermalink) (print $id ".jpg") }} +{{ $img := $img.Content | resources.FromString $destination }} +{{ $img := $img.RelPermalink }} + +{{/* Generate the videos embed url. */}} +{{ $path := path.Join $host "videos" "embed" $id }} +{{ $url := print "https://" $path }} + +{{/* Fetch the videos title via the peertube api. */}} +{{ $title := $videoinfo.name }} + +
+ +
+ + + + +
+ {{ if eq .Page.Lang "de" }} + Wenn angeklickt wird dieses Video von {{ $host }} geladen. + {{ else if eq .Page.Lang "fr" }} + Après avoir cliqué, la vidéo est chargée depuis le site {{ $host }}. + {{ else }} + When clicked, this video is loaded from {{ $host }} + {{ end }} +
+
+
+
{{ $title }}
+
+ {{ if eq .Page.Lang "de" }} + Beim Ansehen dieses Videos wird möglicherweise Ihre IP-Adresse an Dritte weitergegeben. + {{ else if eq .Page.Lang "fr" }} + Regarder cette vidéo en ligne peut révéler votre adresse IP à d’autres personnes. + {{ else }} + Watching this video may reveal your IP address to others. + {{ end }} +
+
+
+
+
+ + + +