diff --git a/localserve.go b/localserve.go index d10ca5c..0a74545 100644 --- a/localserve.go +++ b/localserve.go @@ -164,7 +164,7 @@ during those commands instead of during "data". loadLoglevel(log, fallbackLevel) - golog.Printf("mox, version %s, %s %s/%s", moxvar.Version, runtime.Version(), runtime.GOOS, runtime.GOARCH) + golog.Printf("mox, version %s %s/%s", moxvar.Version, runtime.GOOS, runtime.GOARCH) golog.Print("") golog.Printf("the default user is mox@localhost, with password moxmoxmox") golog.Printf("the default admin password is moxadmin") diff --git a/main.go b/main.go index 8fbca8a..ec2b662 100644 --- a/main.go +++ b/main.go @@ -2845,7 +2845,7 @@ func cmdVersion(c *cmd) { c.Usage() } fmt.Println(moxvar.Version) - fmt.Printf("%s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) + fmt.Printf("%s/%s\n", runtime.GOOS, runtime.GOARCH) } func cmdWebapi(c *cmd) { diff --git a/mox-/lastknown.go b/mox-/lastknown.go index b1a0da9..1cf9c35 100644 --- a/mox-/lastknown.go +++ b/mox-/lastknown.go @@ -19,7 +19,7 @@ func StoreLastKnown(v updates.Version) error { // LastKnown returns the last known version that has been mentioned in an update // email, or the current application. func LastKnown() (current, lastknown updates.Version, mtime time.Time, rerr error) { - curv, curerr := updates.ParseVersion(moxvar.Version) + curv, curerr := updates.ParseVersion(moxvar.VersionBare) p := DataDirPath("lastknownversion") fi, _ := os.Stat(p) @@ -44,7 +44,7 @@ func LastKnown() (current, lastknown updates.Version, mtime time.Time, rerr erro } else if lasterr == nil { return curv, lastknown, mtime, nil } - if moxvar.Version == "(devel)" { + if strings.HasPrefix(moxvar.Version, "(devel)") { return curv, updates.Version{}, mtime, fmt.Errorf("development version") } return curv, updates.Version{}, mtime, fmt.Errorf("parsing version: %w", err) diff --git a/mox-/webappfile.go b/mox-/webappfile.go index f6bebc1..6eaeac0 100644 --- a/mox-/webappfile.go +++ b/mox-/webappfile.go @@ -125,7 +125,7 @@ func (a *WebappFile) Serve(ctx context.Context, log mlog.Log, w http.ResponseWri } var b bytes.Buffer b.Write(html[:index]) - fmt.Fprintf(&b, "") b.Write(html[index+len(script):]) diff --git a/moxvar/version.go b/moxvar/version.go index 0141b86..0b69cd9 100644 --- a/moxvar/version.go +++ b/moxvar/version.go @@ -2,16 +2,24 @@ package moxvar import ( + "runtime" "runtime/debug" ) // Version is set at runtime based on the Go module used to build. -var Version = "(devel)" +var Version string -// VersionBare does not add a "+modifications" or other suffix to the version. -var VersionBare = "(devel)" +// VersionBare does not add a "+modifications", goversion or other suffix to the version. +var VersionBare string func init() { + Version = "(devel)" + VersionBare = "(devel)" + + defer func() { + Version += "-" + runtime.Version() + }() + buildInfo, ok := debug.ReadBuildInfo() if !ok { return diff --git a/webaccount/account.ts b/webaccount/account.ts index 9555ee0..c503548 100644 --- a/webaccount/account.ts +++ b/webaccount/account.ts @@ -3,7 +3,6 @@ // From HTML. declare let page: HTMLElement declare let moxversion: string -declare let moxgoversion: string declare let moxgoos: string declare let moxgoarch: string diff --git a/webadmin/admin.js b/webadmin/admin.js index 735d0fb..b1e8e2c 100644 --- a/webadmin/admin.js +++ b/webadmin/admin.js @@ -1782,7 +1782,7 @@ const crumbs = (...l) => { ]; }; const errmsg = (err) => '' + (err.message || '(no error message)'); -const footer = dom.div(style({ marginTop: '6ex', opacity: 0.75 }), link('https://www.xmox.nl', 'mox'), ' ', moxversion, ' ', moxgoversion, ' ', moxgoos, '/', moxgoarch, ', ', dom.a(attr.href('licenses.txt'), 'licenses')); +const footer = dom.div(style({ marginTop: '6ex', opacity: 0.75 }), link('https://www.xmox.nl', 'mox'), ' ', moxversion, ' ', moxgoos, '/', moxgoarch, ', ', dom.a(attr.href('licenses.txt'), 'licenses')); const age = (date, future, nowSecs) => { if (!nowSecs) { nowSecs = new Date().getTime() / 1000; diff --git a/webadmin/admin.ts b/webadmin/admin.ts index 4087efd..d1b30d9 100644 --- a/webadmin/admin.ts +++ b/webadmin/admin.ts @@ -3,7 +3,6 @@ // From HTML. declare let page: HTMLElement declare let moxversion: string -declare let moxgoversion: string declare let moxgoos: string declare let moxgoarch: string @@ -195,7 +194,6 @@ const footer = dom.div( link('https://www.xmox.nl', 'mox'), ' ', moxversion, ' ', - moxgoversion, ' ', moxgoos, '/', moxgoarch, ', ', dom.a(attr.href('licenses.txt'), 'licenses') ) diff --git a/webmail/webmail.js b/webmail/webmail.js index a65e440..61048c0 100644 --- a/webmail/webmail.js +++ b/webmail/webmail.js @@ -2513,7 +2513,7 @@ const cmdHelp = async () => { return; } window.alert('"mailto:" protocol handler unregistered.'); - })), dom.div(style({ marginTop: '2ex' }), 'Mox is open source email server software, this is version ', moxversion, ', built with ', moxgoversion, ', see ', dom.a(attr.href('licenses.txt'), 'licenses'), '.', dom.br(), 'Feedback, including bug reports, is appreciated! ', link('https://github.com/mjl-/mox/issues/new'))))); + })), dom.div(style({ marginTop: '2ex' }), 'Mox is open source email server software, this is version ', moxversion, ', see ', dom.a(attr.href('licenses.txt'), 'licenses'), '.', dom.br(), 'Feedback, including bug reports, is appreciated! ', link('https://github.com/mjl-/mox/issues/new'))))); }; // Show tooltips for either the focused element, or otherwise for all elements // that aren't reachable with tabindex and aren't marked specially to prevent diff --git a/webmail/webmail.ts b/webmail/webmail.ts index af25bbc..4fefd5f 100644 --- a/webmail/webmail.ts +++ b/webmail/webmail.ts @@ -131,7 +131,6 @@ ensureCSS('.autosize::after', {content: 'attr(data-value)', marginRight: '1em', // From HTML. declare let page: HTMLElement declare let moxversion: string -declare let moxgoversion: string declare let moxgoos: string declare let moxgoarch: string @@ -1335,7 +1334,7 @@ const cmdHelp = async () => { window.alert('"mailto:" protocol handler unregistered.') }), ), - dom.div(style({marginTop: '2ex'}), 'Mox is open source email server software, this is version ', moxversion, ', built with ', moxgoversion, ', see ', dom.a(attr.href('licenses.txt'), 'licenses'), '.', dom.br(), 'Feedback, including bug reports, is appreciated! ', link('https://github.com/mjl-/mox/issues/new')), + dom.div(style({marginTop: '2ex'}), 'Mox is open source email server software, this is version ', moxversion, ', see ', dom.a(attr.href('licenses.txt'), 'licenses'), '.', dom.br(), 'Feedback, including bug reports, is appreciated! ', link('https://github.com/mjl-/mox/issues/new')), ), ), )