From 8bd4136bdc405380e58e351baeec83da00c547b3 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 1 Nov 2019 17:36:04 -0400 Subject: [PATCH] add a quick version check until release machinery gets sorted --- docs/changelog.txt | 2 ++ docs/honk.8 | 4 ++++ honk.go | 6 ++++++ views/about.html | 1 + web.go | 1 + 5 files changed, 14 insertions(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 315e67b..08c1e43 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -2,6 +2,8 @@ changelog -- next ++ Version string in binary. + ++ Make it easier to upgrade by decoupling data dir from ".". + Amend changelog for 0.8.0 in include omitted elements: diff --git a/docs/honk.8 b/docs/honk.8 index 9506e68..0705bf2 100644 --- a/docs/honk.8 +++ b/docs/honk.8 @@ -143,6 +143,10 @@ Restart. There's also a .Pa blob.db file which is important to backup and restore. +.Pp +The current version of the honk binary may be printed with the +.Ic version +command. .Ss SECURITY .Nm is not currently hardened against SSRF, server side request forgery. diff --git a/honk.go b/honk.go index 3db9ee5..f54c6bb 100644 --- a/honk.go +++ b/honk.go @@ -22,11 +22,14 @@ import ( "html/template" "log" notrand "math/rand" + "os" "strconv" "strings" "time" ) +var honkVersion = "honk 0.8.0-dev" + func init() { notrand.Seed(time.Now().Unix()) } @@ -208,6 +211,9 @@ func main() { initdb() case "upgrade": upgradedb() + case "version": + fmt.Println(honkVersion) + os.Exit(0) } db := opendatabase() dbversion := 0 diff --git a/views/about.html b/views/about.html index 4c7cc92..037620e 100644 --- a/views/about.html +++ b/views/about.html @@ -2,5 +2,6 @@
{{ .AboutMsg }} +

version: {{ .HonkVersion }}

diff --git a/web.go b/web.go index 59ced08..49b744a 100644 --- a/web.go +++ b/web.go @@ -1800,6 +1800,7 @@ func servehtml(w http.ResponseWriter, r *http.Request) { templinfo := getInfo(r) templinfo["AboutMsg"] = aboutMsg templinfo["LoginMsg"] = loginMsg + templinfo["HonkVersion"] = honkVersion if u == nil { w.Header().Set("Cache-Control", "max-age=60") }