diff options
-rw-r--r-- | assets/css/default.css | 4 | ||||
-rw-r--r-- | config.json | 3 | ||||
-rw-r--r-- | config.toml | 2 | ||||
-rw-r--r-- | config.yaml | 2 | ||||
-rw-r--r-- | content/default/messages/quickstart.md | 2 | ||||
-rw-r--r-- | themes/default/layouts/_default/home.sources.html | 2 | ||||
-rw-r--r-- | themes/default/layouts/partials/video-container.html | 39 | ||||
-rw-r--r-- | themes/default/layouts/shortcodes/imgur-video.html | 34 | ||||
-rw-r--r-- | themes/default/layouts/shortcodes/video.html | 47 |
9 files changed, 77 insertions, 58 deletions
diff --git a/assets/css/default.css b/assets/css/default.css index c3a4589..2160d8d 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -1568,10 +1568,6 @@ kbd { color: var(--disabled); } -[id^="imgur-embed-iframe-pub"] { - min-width: 100%; -} - [role="doc-endnotes"] { margin-bottom: 0.75rem; } diff --git a/config.json b/config.json index aca94bd..5912179 100644 --- a/config.json +++ b/config.json @@ -128,7 +128,8 @@ ], "mediasrc": [ "'self'", - "raw.githubusercontent.com" + "raw.githubusercontent.com", + "i.imgur.com" ], "objectsrc": [ "'none'" diff --git a/config.toml b/config.toml index 1be38e8..1991457 100644 --- a/config.toml +++ b/config.toml @@ -104,7 +104,7 @@ enableRobotsTXT = true formaction = ["'self'", "lite.duckduckgo.com"] framesrc = ["'self'", "imgur.com", "www.youtube-nocookie.com", "platform.twitter.com", "en.m.wikipedia.org", "odysee.com", "docs.google.com"] imgsrc = ["'self'", "http://preview.test", "imgs.xkcd.com"] - mediasrc = ["'self'", "raw.githubusercontent.com"] + mediasrc = ["'self'", "raw.githubusercontent.com", "i.imgur.com"] objectsrc = ["'none'"] prefetchsrc = ["'self'"] scriptsrc = ["'self'", "s.imgur.com", "platform.twitter.com"] diff --git a/config.yaml b/config.yaml index d0fe6da..6d89366 100644 --- a/config.yaml +++ b/config.yaml @@ -90,7 +90,7 @@ params: framesrc: ["'self'", imgur.com, www.youtube-nocookie.com, platform.twitter.com, en.m.wikipedia.org, odysee.com, docs.google.com] imgsrc: ["'self'", http://preview.test, imgs.xkcd.com] - mediasrc: ["'self'", raw.githubusercontent.com] + mediasrc: ["'self'", raw.githubusercontent.com, i.imgur.com] objectsrc: ["'none'"] prefetchsrc: ["'self'"] scriptsrc: ["'self'", s.imgur.com, platform.twitter.com] diff --git a/content/default/messages/quickstart.md b/content/default/messages/quickstart.md index 917b171..deaec55 100644 --- a/content/default/messages/quickstart.md +++ b/content/default/messages/quickstart.md @@ -11,7 +11,7 @@ explaining how to get started. The copy button is broken... GIT CLONE. EXECUTE HUGO TWICE. HUGO VERSION >= 0.94.2. ```shell -git clone --branch 0.5.30 https://www.thedroneely.com/git/thedroneely/canory +git clone --branch 0.6.28 https://www.thedroneely.com/git/thedroneely/canory cd canory hugo && hugo ``` diff --git a/themes/default/layouts/_default/home.sources.html b/themes/default/layouts/_default/home.sources.html index fef3b49..ce2100a 100644 --- a/themes/default/layouts/_default/home.sources.html +++ b/themes/default/layouts/_default/home.sources.html @@ -101,7 +101,7 @@ <footer> <p> - Canory Version: 0.5.30 + Canory Version: 0.6.28 · Dictionary Access by Paul Lutus: <a href="https://arachnoid.com/javascript/dictionary_access.js">GPLv2+ License</a> · Feather Icons by Cole Bemis: <a href="https://github.com/feathericons/feather/blob/8b5d6802fa8fd1eb3924b465ff718d2fa8d61efe/LICENSE">MIT License</a> · Tabler Icons by PaweÅ‚ Kuna: <a href="https://github.com/tabler/tabler-icons/blob/60f39297d0f785f2e8635faca6857b2260b2d164/LICENSE">MIT License</a> diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html new file mode 100644 index 0000000..8292f12 --- /dev/null +++ b/themes/default/layouts/partials/video-container.html @@ -0,0 +1,39 @@ +{{- $cache := "" -}} +{{- $public := print "public/" .Source -}} +{{- $timestamp := print "#t=" .Start "," .End -}} + +{{- with $remote := resources.GetRemote .Source -}} + {{- with .Err -}} + {{- if fileExists $public -}} + {{- else -}} + {{ $caption = "No local video data found for source" }} + {{- end -}} + {{- else -}} + {{ end }} + {{- $cache = .Content | resources.FromString (print $.Author "/media/" (. | urlize)) -}} + {{- $cache = $cache.RelPermalink }} +{{ else }} + {{ $caption = "No remote video data found for source" }} +{{- end -}} + +<video-container> + <video + title="{{ .Title }}" + preload="{{ .Preload }}" + {{ with .Poster }} poster="{{ . }}" {{ end -}} + {{ with .Width }} width="{{ . }}" {{ end -}} + {{ with .Height }} height="{{ . }}" {{ end -}} + {{ .Controls | safeHTMLAttr }}> + <source src="{{ or .Source .Cache }}{{ $timestamp }}"> + <p> + Sorry, your browser does not support embedded videos. Here is a + <a href="{{ .Source }}">link to the video</a> instead. + </p> + </video> + <footer> + {{ .Caption | markdownify }} + <br> + Index: {{ with $cache }} {{ print "[Cache](" . ")" | markdownify }} · {{ end }} + {{ print "[Source](" .Source ")" | markdownify }} + </footer> +</video-container> diff --git a/themes/default/layouts/shortcodes/imgur-video.html b/themes/default/layouts/shortcodes/imgur-video.html index bdb087d..72c7af3 100644 --- a/themes/default/layouts/shortcodes/imgur-video.html +++ b/themes/default/layouts/shortcodes/imgur-video.html @@ -1,20 +1,16 @@ -{{- $id := default "uVrh84e" (.Get "id" | default (.Get 0)) -}} -{{- $title := default "Imgur Gif" (.Get "title" | default (.Get 1)) -}} +{{- $id := default "rQIb4Vw" (.Get "id" | default (.Get 0)) -}} +{{- $title := default "Imgur Gif" (.Get "title" | default (.Get 1)) -}} +{{- $caption := default "Imgur Gif" (.Get "caption" | default (.Get 2)) -}} -<imgur-video> - <blockquote - class="imgur-embed-pub" - lang="en" - data-id="{{ $id }}" - data-context="false"> - <a href="//imgur.com/{{ $id }}"></a> - </blockquote> - <script async src="//s.imgur.com/min/embed.js"></script> - <noscript> - <a href="//imgur.com/{{ $id }}">imgur.com/{{ $id }}</a> - </noscript> - <footer> - {{ $title | markdownify }} - ({{ print "[Link](https://imgur.com/" $id ")" | markdownify }}) - </footer> -</imgur-video> +{{- $controls := default "controls autoplay loop muted playsinline" + (.Get "controls" | default (.Get 3)) +-}} + +{{- partial "video-container.html" + (dict + "Author" .Page.Section + "Caption" $caption + "Controls" $controls + "Source" (print "https://i.imgur.com/" $id ".mp4") + ) +-}} diff --git a/themes/default/layouts/shortcodes/video.html b/themes/default/layouts/shortcodes/video.html index 5f6d8c3..4eb5fb6 100644 --- a/themes/default/layouts/shortcodes/video.html +++ b/themes/default/layouts/shortcodes/video.html @@ -7,38 +7,25 @@ {{- $width := default "" (.Get "width" | default (.Get 2)) -}} {{- $height := default "" (.Get "height" | default (.Get 3)) -}} {{- $preload := default "metadata" (.Get "preload" | default (.Get 4)) -}} -{{- $controls := default "" (.Get "controls" | default (.Get 5)) -}} +{{- $controls := default "controls" (.Get "controls" | default (.Get 5)) -}} {{- $caption := default "`HTML5` Video" (.Get "caption" | default (.Get 6)) -}} {{- $title := default "HTML5 Video" (.Get "title" | default (.Get 7)) -}} {{- $start := default "" (.Get "start" | default (.Get 8)) -}} {{- $end := default "" (.Get "end" | default (.Get 9)) -}} -{{- $path := replace (path.Dir $source) ":/" "://" 1 -}} -{{- $base := split (path.Base $source) "." -}} -{{- $name := index (first (sub (len $base) 1) $base) 0 -}} -{{- $mime := path.Ext $source -}} -{{- $source = print $path "/" $name -}} - -<video-container> - <video - title="{{ $title }}" - preload="{{ $preload }}" - poster="{{ $poster }}" - width="{{ $width }}" - height="{{ $height }}" - controls="{{ $controls | safeHTMLAttr }}"> - <source src="{{ $source}}{{ $mime }}#t={{ $start }},{{ $end }}" type="video/{{ $mime }}"> - <source src="{{ $source }}.mp4#t={{ $start}},{{ $end }}" type="video/mp4"> - <source src="{{ $source }}.webm#t={{ $start }},{{ $end }}" type="video/webm"> - <source src="{{ $source }}.flv#t={{ $start }},{{ $end }}" type="video/flv"> - <source src="{{ $source }}.ogv#t={{ $start }},{{ $end }}" type="video/ogv"> - <p> - Sorry, your browser does not support embedded videos. Here is a - <a href="{{ $source }}{{ $mime }}#t={{ $start }},{{ $end }}">link to the video</a> instead. - </p> - </video> - <footer> - {{ $caption | markdownify }} - ({{ print "[Link](" $source $mime ")" | markdownify }}) - </footer> -</video-container> +{{- partial "video-container.html" + (dict + "Author" .Page.Section + "Caption" $caption + "Controls" $controls + "End" $end + "Height" $height + "Poster" $poster + "Preload" $preload + "Source" $source + "Source" $source + "Start" $start + "Title" $title + "Width" $width + ) +-}} |