From 7f2f3d8700f3ea2e895a19dd10bc64f14127f1d9 Mon Sep 17 00:00:00 2001 From: Adora Laura Kalb Date: Sat, 3 Aug 2024 18:49:02 +0200 Subject: [PATCH 1/3] add version tags on portfolio page --- content/portfolio.md | 6 ++++ layouts/_default/baseof.html | 1 + layouts/partials/head/scripts.html | 3 ++ .../shortcodes/latest-forgejo-version.html | 1 + static/js/latest-version.js | 30 +++++++++++++++++++ 5 files changed, 41 insertions(+) create mode 100644 layouts/partials/head/scripts.html create mode 100644 layouts/shortcodes/latest-forgejo-version.html create mode 100644 static/js/latest-version.js diff --git a/content/portfolio.md b/content/portfolio.md index 14a484d..0e05211 100644 --- a/content/portfolio.md +++ b/content/portfolio.md @@ -1,6 +1,9 @@ --- title: "Portfolio" description: "Adoras Software Development portfolio" +params: + JS: + LatestVersion: true --- Here you can find a list of projects I worked on or am currently working on: @@ -9,18 +12,21 @@ Here you can find a list of projects I worked on or am currently working on: Language: `Go` Source: [code.lila.network/adoralaura/certwarden-deploy](https://code.lila.network/adoralaura/certwarden-deploy) Documentation: [certwarden-deploy.adora.codes](https://certwarden-deploy.adora.codes) +Latest Version: {{< latest-forgejo-version "adoralaura/certwarden-deploy" >}} Deployment tool for (Let's Encrypt) certificates managed by a CertWarden Instance (similar to certbot or acme.sh, just without the ACME stuff) ## Mailcow Alias Automation Language: `Go` Source: [code.lila.network/adoralaura/mailcow-admin-aliases](https://code.lila.network/adoralaura/mailcow-admin-aliases) +Latest Version: {{< latest-forgejo-version "adoralaura/mailcow-admin-aliases" >}} Automates the creation of important admin mail aliases (think security@..., postmaster@...). ## ntppool-exporter Language: `Go` Source: [code.lila.network/adoralaura/ntppool-exporter](https://code.lila.network/adoralaura/ntppool-exporter) +Latest Version: {{< latest-forgejo-version "adoralaura/ntppool-exporter" >}} A Prometheus exporter application that pulls data from the ntppool.org API for a given NTP server and serves it in a Prometheus compatible format. diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 3f73e7f..e8b8124 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -6,6 +6,7 @@ {{ or .Title .Site.Title }} {{ partial "head/favicon.html" . }} {{ partial "head/styling.html" . }} + {{ partial "head/scripts.html" . }} {{ partial "body/nav.html" . }} diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html new file mode 100644 index 0000000..14b8af2 --- /dev/null +++ b/layouts/partials/head/scripts.html @@ -0,0 +1,3 @@ +{{ if .Page.Params.JS.LatestVersion }} + +{{ end }} diff --git a/layouts/shortcodes/latest-forgejo-version.html b/layouts/shortcodes/latest-forgejo-version.html new file mode 100644 index 0000000..ff789f8 --- /dev/null +++ b/layouts/shortcodes/latest-forgejo-version.html @@ -0,0 +1 @@ +currently unavailable diff --git a/static/js/latest-version.js b/static/js/latest-version.js new file mode 100644 index 0000000..6dd3612 --- /dev/null +++ b/static/js/latest-version.js @@ -0,0 +1,30 @@ +async function FillLatestForgejoRelease() { + + const apiPath = `https://forgejo-proxy.services-prod.lila.network/api/v1/code.lila.network/releases` + + + var forgejoItems = document.getElementsByClassName('forgejo-version') + + const requestOptions = { + method: "GET", + redirect: "follow", + + }; + + [...forgejoItems].forEach(async item => { + var repo = item.getAttribute("data-forgejo-repo"); + + var queryParam = new URLSearchParams({ namespace: repo }).toString() + + + var response = await fetch(`${apiPath}?${queryParam}`, requestOptions) + + if (response.ok) { + + item.textContent = await response.text() + } + }); +} + + +FillLatestForgejoRelease() -- 2.39.5 From 75344a1a21073ddd79653ae6ee254c0c5b789729 Mon Sep 17 00:00:00 2001 From: Adora Laura Kalb Date: Sat, 3 Aug 2024 18:50:12 +0200 Subject: [PATCH 2/3] fix whitespace issue --- content/portfolio.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/portfolio.md b/content/portfolio.md index 0e05211..e953f1d 100644 --- a/content/portfolio.md +++ b/content/portfolio.md @@ -11,21 +11,21 @@ Here you can find a list of projects I worked on or am currently working on: ## certwarden-deploy Language: `Go` Source: [code.lila.network/adoralaura/certwarden-deploy](https://code.lila.network/adoralaura/certwarden-deploy) -Documentation: [certwarden-deploy.adora.codes](https://certwarden-deploy.adora.codes) +Documentation: [certwarden-deploy.adora.codes](https://certwarden-deploy.adora.codes) Latest Version: {{< latest-forgejo-version "adoralaura/certwarden-deploy" >}} Deployment tool for (Let's Encrypt) certificates managed by a CertWarden Instance (similar to certbot or acme.sh, just without the ACME stuff) ## Mailcow Alias Automation Language: `Go` -Source: [code.lila.network/adoralaura/mailcow-admin-aliases](https://code.lila.network/adoralaura/mailcow-admin-aliases) +Source: [code.lila.network/adoralaura/mailcow-admin-aliases](https://code.lila.network/adoralaura/mailcow-admin-aliases) Latest Version: {{< latest-forgejo-version "adoralaura/mailcow-admin-aliases" >}} Automates the creation of important admin mail aliases (think security@..., postmaster@...). ## ntppool-exporter Language: `Go` -Source: [code.lila.network/adoralaura/ntppool-exporter](https://code.lila.network/adoralaura/ntppool-exporter) +Source: [code.lila.network/adoralaura/ntppool-exporter](https://code.lila.network/adoralaura/ntppool-exporter) Latest Version: {{< latest-forgejo-version "adoralaura/ntppool-exporter" >}} A Prometheus exporter application that pulls data from the ntppool.org API for a given NTP server and serves it in a Prometheus compatible format. -- 2.39.5 From 622e88f0dfe7a6a40d72663ce26b327380f5f272 Mon Sep 17 00:00:00 2001 From: Adora Laura Kalb Date: Sat, 3 Aug 2024 19:16:24 +0200 Subject: [PATCH 3/3] make version string a simple span --- layouts/shortcodes/latest-forgejo-version.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/shortcodes/latest-forgejo-version.html b/layouts/shortcodes/latest-forgejo-version.html index ff789f8..89e9498 100644 --- a/layouts/shortcodes/latest-forgejo-version.html +++ b/layouts/shortcodes/latest-forgejo-version.html @@ -1 +1 @@ -currently unavailable +currently unavailable -- 2.39.5