include goversion used to compile mox in the mox version

This commit is contained in:
Mechiel Lukkien 2024-11-28 16:28:05 +01:00
parent 636bb91df6
commit d7f057709f
No known key found for this signature in database
10 changed files with 19 additions and 15 deletions

View file

@ -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")

View file

@ -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) {

View file

@ -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)

View file

@ -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, "<script>\n// Javascript is generated from typescript, don't modify the javascript because changes will be lost.\nconst moxversion = \"%s\";\nconst moxgoversion = \"%s\";\nconst moxgoos = \"%s\";\nconst moxgoarch = \"%s\";\n", moxvar.Version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
fmt.Fprintf(&b, "<script>\n// Javascript is generated from typescript, don't modify the javascript because changes will be lost.\nconst moxversion = \"%s\";\nconst moxgoos = \"%s\";\nconst moxgoarch = \"%s\";\n", moxvar.Version, runtime.GOOS, runtime.GOARCH)
b.Write(js)
b.WriteString("\t\t</script>")
b.Write(html[index+len(script):])

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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')
)

View file

@ -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

View file

@ -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')),
),
),
)