web interfaces: don't include version number in html, only return it after authentication

second round for issue #322
This commit is contained in:
Mechiel Lukkien
2025-03-29 20:46:53 +01:00
parent eeeabdc6de
commit 3a3a11560e
18 changed files with 217 additions and 35 deletions

View File

@ -2,12 +2,13 @@
// From HTML.
declare let page: HTMLElement
declare let moxversion: string
declare let moxgoos: string
declare let moxgoarch: string
// From customization script.
declare let moxBeforeDisplay: (webmailroot: HTMLElement) => void
let moxversion: string
let moxgoos: string
let moxgoarch: string
const login = async (reason: string) => {
return new Promise<string>((resolve: (v: string) => void, _) => {
const origFocus = document.activeElement
@ -191,14 +192,15 @@ const crumbs = (...l: ({text: string, path: string} | string)[]) => {
const errmsg = (err: unknown) => ''+((err as any).message || '(no error message)')
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 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: Date, future: boolean, nowSecs: number) => {
if (!nowSecs) {
@ -438,7 +440,7 @@ const index = async () => {
dom.div(dom.a('Webserver', attr.href('#webserver'))),
dom.div(dom.a('Files', attr.href('#config'))),
dom.div(dom.a('Log levels', attr.href('#loglevels'))),
footer,
footer(),
)
}
@ -4249,7 +4251,7 @@ const hooksList = async () => {
style({textAlign: 'right'}), // Less content shifting while rendering.
'Sort ',
sortElem=dom.select(
attr.form('hooksfilter'),
attr.form('hooksfilter'),
function change() {
filterForm.requestSubmit()
},
@ -5342,6 +5344,8 @@ const webserver = async () => {
const init = async () => {
let curhash: string | undefined
[moxversion, moxgoos, moxgoarch] = await client.Version()
const hashChange = async () => {
if (curhash === window.location.hash) {
return