From 81dd95416fcb6c242731933082be1cd447366f73 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 5 Jun 2024 23:41:56 +0300 Subject: about: add link to commit when showing soko's current commit id Based-on: Florian Schmaus Resolves: https://github.com/gentoo/soko/pull/26 Signed-off-by: Arthur Zamarin --- pkg/app/handler/about/index.templ | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/pkg/app/handler/about/index.templ b/pkg/app/handler/about/index.templ index 7d4311d..16a0b5f 100644 --- a/pkg/app/handler/about/index.templ +++ b/pkg/app/handler/about/index.templ @@ -9,22 +9,13 @@ func getCommitId() string { if info, ok := debug.ReadBuildInfo(); ok { for _, setting := range info.Settings { if setting.Key == "vcs.revision" { - return setting.Value[:8] + return setting.Value } } } return "" } -func versionText() string { - commitId := getCommitId() - version := config.Version() - if commitId == "" { - return "Currently " + version + " is running." - } - return "Currently " + version + " is running, based on commit " + commitId + "." -} - templ index() {
@@ -40,7 +31,13 @@ templ index() {

FAQ

Which version is currently running?
-
{ versionText() }
+
+ if commitId := getCommitId(); commitId == "" { + Currently { config.Version() } is running. + } else { + Currently { config.Version() } is running, based on commit