show goversion and goos/goarch on admin page

This commit is contained in:
Mechiel Lukkien 2024-03-11 08:58:40 +01:00
parent b115c7b10d
commit 4699504c9f
No known key found for this signature in database
6 changed files with 17 additions and 5 deletions

View file

@ -10,6 +10,7 @@ import (
"log/slog" "log/slog"
"net/http" "net/http"
"os" "os"
"runtime"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -124,7 +125,7 @@ func (a *WebappFile) Serve(ctx context.Context, log mlog.Log, w http.ResponseWri
} }
var b bytes.Buffer var b bytes.Buffer
b.Write(html[:index]) 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\";\n", moxvar.Version) 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)
b.Write(js) b.Write(js)
b.WriteString("\t\t</script>") b.WriteString("\t\t</script>")
b.Write(html[index+len(script):]) b.Write(html[index+len(script):])

View file

@ -3,6 +3,9 @@
// From HTML. // From HTML.
declare let page: HTMLElement declare let page: HTMLElement
declare let moxversion: string declare let moxversion: string
declare let moxgoversion: string
declare let moxgoos: string
declare let moxgoarch: string
const login = async (reason: string) => { const login = async (reason: string) => {
return new Promise<string>((resolve: (v: string) => void, _) => { return new Promise<string>((resolve: (v: string) => void, _) => {

View file

@ -1479,7 +1479,7 @@ const crumbs = (...l) => [
dom.br() dom.br()
]; ];
const errmsg = (err) => '' + (err.message || '(no error message)'); 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); const footer = dom.div(style({ marginTop: '6ex', opacity: 0.75 }), link('https://www.xmox.nl', 'mox'), ' ', moxversion, ' ', moxgoversion, ' ', moxgoos, '/', moxgoarch);
const age = (date, future, nowSecs) => { const age = (date, future, nowSecs) => {
if (!nowSecs) { if (!nowSecs) {
nowSecs = new Date().getTime() / 1000; nowSecs = new Date().getTime() / 1000;

View file

@ -3,6 +3,9 @@
// From HTML. // From HTML.
declare let page: HTMLElement declare let page: HTMLElement
declare let moxversion: string declare let moxversion: string
declare let moxgoversion: string
declare let moxgoos: string
declare let moxgoarch: string
const login = async (reason: string) => { const login = async (reason: string) => {
return new Promise<string>((resolve: (v: string) => void, _) => { return new Promise<string>((resolve: (v: string) => void, _) => {
@ -120,7 +123,9 @@ const footer = dom.div(
style({marginTop: '6ex', opacity: 0.75}), style({marginTop: '6ex', opacity: 0.75}),
link('https://www.xmox.nl', 'mox'), link('https://www.xmox.nl', 'mox'),
' ', ' ',
moxversion, moxversion, ' ',
moxgoversion, ' ',
moxgoos, '/', moxgoarch,
) )
const age = (date: Date, future: boolean, nowSecs: number) => { const age = (date: Date, future: boolean, nowSecs: number) => {

View file

@ -2182,7 +2182,7 @@ const cmdHelp = async () => {
return; return;
} }
window.alert('"mailto:" protocol handler unregistered.'); window.alert('"mailto:" protocol handler unregistered.');
})), dom.div(style({ marginTop: '2ex' }), 'Mox is open source email server software, this is version ' + moxversion + '. 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, ', built with ', moxgoversion, '. 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 // 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 // that aren't reachable with tabindex and aren't marked specially to prevent

View file

@ -112,6 +112,9 @@ const zindexes = {
// From HTML. // From HTML.
declare let page: HTMLElement declare let page: HTMLElement
declare let moxversion: string declare let moxversion: string
declare let moxgoversion: string
declare let moxgoos: string
declare let moxgoarch: string
// All logging goes through log() instead of console.log, except "should not happen" logging. // All logging goes through log() instead of console.log, except "should not happen" logging.
let log: (...args: any[]) => void = () => {} let log: (...args: any[]) => void = () => {}
@ -1197,7 +1200,7 @@ const cmdHelp = async () => {
window.alert('"mailto:" protocol handler unregistered.') window.alert('"mailto:" protocol handler unregistered.')
}), }),
), ),
dom.div(style({marginTop: '2ex'}), 'Mox is open source email server software, this is version '+moxversion+'. 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, ', built with ', moxgoversion, '. Feedback, including bug reports, is appreciated! ', link('https://github.com/mjl-/mox/issues/new'), '.'),
), ),
), ),
) )