From a74061e08bd5923ab1d835a89a1eddbb72f3ac50 Mon Sep 17 00:00:00 2001 From: Thilo Molitor Date: Tue, 9 Jul 2024 22:30:15 +0200 Subject: [PATCH] Cache weblate translation status image on build Don't leak IP of website visitors to weblate --- content/support.md | 6 +++++- layouts/shortcodes/remoteImage.html | 9 +++++++++ themes/hugo-PaperMod | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 layouts/shortcodes/remoteImage.html diff --git a/content/support.md b/content/support.md index 4c8d489..30e8139 100644 --- a/content/support.md +++ b/content/support.md @@ -1,6 +1,10 @@ --- title: "Support" date: 2022-03-12T10:01:54+01:00 +resources: +- src: "https://hosted.weblate.org/widgets/monal/-/multi-auto.svg" + name: "weblate.svg" + title: "Detailed translation status" tags: [] author: "Monal" @@ -27,7 +31,7 @@ Find general information in the [Monal Wiki](https://github.com/monal-im/Monal/w We host and manage translations via [Weblate](https://hosted.weblate.org/engage/monal/). Feel free to translate Monal to your language! -[![Detailed translation status](https://hosted.weblate.org/widgets/monal/-/multi-auto.svg)](https://hosted.weblate.org/engage/monal/?utm_source=widget) +{{< remoteImage "weblate.svg" >}} ## Reporting a Vulnerability diff --git a/layouts/shortcodes/remoteImage.html b/layouts/shortcodes/remoteImage.html new file mode 100644 index 0000000..c19e8d0 --- /dev/null +++ b/layouts/shortcodes/remoteImage.html @@ -0,0 +1,9 @@ +{{ if .IsNamedParams }} + {{ $image := $.Page.Resources.GetMatch (.Get "name") }} + {{ $title := cond (not (.Get "title")) $image.title (.Get "title") }} + +{{ else }} + {{ $image := $.Page.Resources.GetMatch (.Get 0) }} + {{ $title := cond (not (.Get 1)) $image.title (.Get 1) }} + +{{ end }} diff --git a/themes/hugo-PaperMod b/themes/hugo-PaperMod index dad94ab..5381e57 160000 --- a/themes/hugo-PaperMod +++ b/themes/hugo-PaperMod @@ -1 +1 @@ -Subproject commit dad94ab4b7c55eea0b63f7b81419d027fe9a8d81 +Subproject commit 5381e5715de856351adabbf0850be85ff28145c5