From 9233435be2ca81cac5b6f6244ddbdf211b7e31e8 Mon Sep 17 00:00:00 2001 From: omartek Date: Mon, 22 Jul 2024 13:38:55 +0200 Subject: [PATCH] peertube shortcode --- .../index.it.md | 3 +- layouts/shortcodes/peertube.html | 92 +++++++++++++++++++ layouts/shortcodes/peertube2.html | 13 +++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 layouts/shortcodes/peertube.html create mode 100644 layouts/shortcodes/peertube2.html diff --git a/content/linuxday/2015/devops-e-ansible-nuovi-modi-per-gestire-i-server/index.it.md b/content/linuxday/2015/devops-e-ansible-nuovi-modi-per-gestire-i-server/index.it.md index 12053d0..01bf75e 100644 --- a/content/linuxday/2015/devops-e-ansible-nuovi-modi-per-gestire-i-server/index.it.md +++ b/content/linuxday/2015/devops-e-ansible-nuovi-modi-per-gestire-i-server/index.it.md @@ -18,7 +18,8 @@ image_alt: Logo Ansible **Francesco Vigotti**, creatore e gestore di [histats.com](https://www.histats.com) e ...uno che la sa lunga 😉, ci parla delle più recenti tecnologie **opensource** per gestire server: DevOps e Ansible. -{{< youtube ld5UTbOnIc0 >}} PS: [Guarda le slide dell'intervento](Ansible-talk-linuxday.pdf) + +{{< peertube video.linux.it 3SUuYCXJqC2M7V35fu7ifX >}} \ No newline at end of file diff --git a/layouts/shortcodes/peertube.html b/layouts/shortcodes/peertube.html new file mode 100644 index 0000000..cedd3b4 --- /dev/null +++ b/layouts/shortcodes/peertube.html @@ -0,0 +1,92 @@ +{{/* 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. */}} +{{ $path := path.Join $host "lazy-static" "previews" $id }} +{{ $url := print "https://" $path ".jpg" }} +{{ $destination := path.Join (.Page.RelPermalink) (print $id ".jpg") }} +{{ $img := resources.GetRemote $url }} +{{ $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. */}} +{{ $path := path.Join $host "api" "v1" "videos" $id }} +{{ $endpoint := print "https://" $path }} +{{ $result := getJSON $endpoint }} +{{ $title := $result.name }} + + + +
+ +
+ + + + +
+ {{ if eq .Page.Lang "de" }} + Wenn angeklickt wird dieses Video von {{ $host }} geladen. + {{ 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 }} + Watching this video may reveal your IP address to others. + {{ end }} +
+
+
+
+
+ + + + diff --git a/layouts/shortcodes/peertube2.html b/layouts/shortcodes/peertube2.html new file mode 100644 index 0000000..d9a6368 --- /dev/null +++ b/layouts/shortcodes/peertube2.html @@ -0,0 +1,13 @@ +{{ if .IsNamedParams -}} +
+ +
+{{- else -}} +
+ +
+{{- end }} \ No newline at end of file