diff options
author | tdro <tdro@noreply.example.com> | 2022-12-03 01:02:40 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-12-03 01:02:40 -0500 |
commit | 2fe40c752b4272484972f141e406fbcb7fa0cdb8 (patch) | |
tree | 9e5248b8a8488527a526d3a950731050b665eb7d /themes | |
parent | c1a0a33c40b08eb13e412a95cdcdfd869eb3bf2d (diff) | |
download | canory-2fe40c752b4272484972f141e406fbcb7fa0cdb8.tar.gz canory-2fe40c752b4272484972f141e406fbcb7fa0cdb8.tar.bz2 canory-2fe40c752b4272484972f141e406fbcb7fa0cdb8.zip |
themes/default/layouts/shortcodes/video.html: Default to self always0.11.7
To avoid hotlinking by mistake. Support media start and end fragments
(https://www.w3.org/TR/media-frags/) separately. Add remote parameter
for offloading to source
Diffstat (limited to 'themes')
-rw-r--r-- | themes/default/layouts/partials/video-container.html | 21 | ||||
-rw-r--r-- | themes/default/layouts/shortcodes/imgur.html | 13 | ||||
-rw-r--r-- | themes/default/layouts/shortcodes/version.html | 2 | ||||
-rw-r--r-- | themes/default/layouts/shortcodes/video.html | 5 |
4 files changed, 22 insertions, 19 deletions
diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html index 488d4ec..520a16d 100644 --- a/themes/default/layouts/partials/video-container.html +++ b/themes/default/layouts/partials/video-container.html @@ -1,12 +1,22 @@ {{- $cache := "" -}} +{{- $source := "" -}} {{- $timestamp := "" -}} {{- $caption := .Caption -}} +{{- $remote := .Remote -}} {{- $public := print "public/" .Source -}} {{- $immutable := print (.RelURL | humanize | urlize) "-" (.Source | sha256 | truncate 8 "") -}} {{- $extension := path.Ext .Source -}} {{- $fileCache := print $.Author "/media/" $immutable $extension -}} {{- $notCached := not (fileExists (path.Join "public/" $fileCache)) -}} +{{- if .Start -}} + {{- $timestamp = print "#t=" .Start -}} +{{- end -}} + +{{- if .End -}} + {{- $timestamp = print "#t=," .End -}} +{{- end -}} + {{- if and .Start .End -}} {{- $timestamp = print "#t=" .Start "," .End -}} {{- end -}} @@ -14,8 +24,7 @@ {{- if $notCached -}} {{- with $remote := resources.GetRemote .Source -}} {{- with .Err -}} - {{- if fileExists $public -}} - {{- else -}} + {{- if not (fileExists $public) -}} {{- $caption = "No local video data found for source" -}} {{- end -}} {{- else -}} @@ -31,6 +40,12 @@ {{- $cache = $cache.Permalink -}} {{- end -}} +{{- $source = $cache -}} + +{{- if .Remote -}} + {{- $source = .Source -}} +{{- end -}} + <video-container> <video title="{{ .Title }}" @@ -40,7 +55,7 @@ {{ with .Width }} width="{{ . }}" {{ end -}} {{ with .Height }} height="{{ . }}" {{ end -}} {{ .Options | safeHTMLAttr }}> - <source src="{{ or .Source .Cache }}{{ $timestamp }}"> + <source src="{{ $source }}{{ $timestamp }}"> {{ print "Video: " $caption "." | markdownify }} <p> Sorry, your browser does not support embedded videos. Here is a diff --git a/themes/default/layouts/shortcodes/imgur.html b/themes/default/layouts/shortcodes/imgur.html deleted file mode 100644 index f51bcef..0000000 --- a/themes/default/layouts/shortcodes/imgur.html +++ /dev/null @@ -1,13 +0,0 @@ -{{- $id := default "mkVcxUi" (.Get "id" | default (.Get 0)) -}} - -<imgur-image> - <blockquote - class="imgur-embed-pub" - lang="en" - data-id="a/{{ $id }}" - data-context="false" - > - <a href="//imgur.com/a/{{ $id }}"></a> - </blockquote> - <script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script> -</imgur-image> diff --git a/themes/default/layouts/shortcodes/version.html b/themes/default/layouts/shortcodes/version.html index c34a53d..9c993b3 100644 --- a/themes/default/layouts/shortcodes/version.html +++ b/themes/default/layouts/shortcodes/version.html @@ -1,4 +1,4 @@ -{{- $version := "0.11.6" -}} +{{- $version := "0.11.7" -}} {{- $number := default false (.Get "number" | default (.Get 0)) -}} {{- $clone := default false (.Get "clone" | default (.Get 1)) -}} diff --git a/themes/default/layouts/shortcodes/video.html b/themes/default/layouts/shortcodes/video.html index 1aadbbd..64de78f 100644 --- a/themes/default/layouts/shortcodes/video.html +++ b/themes/default/layouts/shortcodes/video.html @@ -13,6 +13,7 @@ {{- $start := default "" (.Get "start" | default (.Get 8)) -}} {{- $end := default "" (.Get "end" | default (.Get 9)) -}} {{- $orientation := default "landscape" (.Get "orientation" | default (.Get 10)) -}} +{{- $remote := default "" (.Get "remote" | default (.Get 11)) -}} {{- partial "video-container.html" (dict @@ -21,14 +22,14 @@ "End" $end "Height" $height "Options" $options + "Orientation" $orientation "Poster" $poster "Preload" $preload "RelURL" (strings.TrimPrefix .Site.BaseURL .Page.Permalink) - "Source" $source + "Remote" $remote "Source" $source "Start" $start "Title" $title "Width" $width - "Orientation" $orientation ) -}} |