Skip to content

Commit

Permalink
about: add link to commit when showing soko's current commit id
Browse files Browse the repository at this point in the history
Based-on: Florian Schmaus <[email protected]>
Resolves: #26
Signed-off-by: Arthur Zamarin <[email protected]>
  • Loading branch information
Flowdalic authored and arthurzam committed Jun 5, 2024
1 parent 1966444 commit 81dd954
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions pkg/app/handler/about/index.templ
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
<div class="container mb-5">
<div class="row">
Expand All @@ -40,7 +31,13 @@ templ index() {
<h2>FAQ</h2>
<dl>
<dt>Which version is currently running?</dt>
<dd>{ versionText() }</dd>
<dd>
if commitId := getCommitId(); commitId == "" {
Currently { config.Version() } is running.
} else {
Currently { config.Version() } is running, based on commit <a href={ templ.URL("https://gitweb.gentoo.org/sites/soko.git/commit/?id=" + commitId) }>{ commitId[:8] }</a>.
}
</dd>
<br/>
<dt>How often is the site updated?</dt>
<dd>
Expand Down

0 comments on commit 81dd954

Please sign in to comment.