on admin page, show warning when user hasn't enabled "check updates"

and send Accept-header when fetching changelog, so we can show an html version
instead of json when requested by regular browsers.
This commit is contained in:
Mechiel Lukkien
2023-02-27 15:03:37 +01:00
parent d3590caa2e
commit 67c97c6499
4 changed files with 22 additions and 1 deletions

View File

@ -190,9 +190,10 @@ const formatSize = n => {
}
const index = async () => {
const [domains, queueSize] = await Promise.all([
const [domains, queueSize, checkUpdatesEnabled] = await Promise.all([
await api.Domains(),
await api.QueueSize(),
await api.CheckUpdatesEnabled(),
])
let fieldset, domain, account, localpart
@ -200,6 +201,7 @@ const index = async () => {
const page = document.getElementById('page')
dom._kids(page,
crumbs('Mox Admin'),
checkUpdatesEnabled ? [] : dom.p(box(yellow, 'Warning: Checking for updates has not been enabled in mox.conf (CheckUpdates: true).', dom.br(), 'Make sure you stay up to date through another mechanism!', dom.br(), 'You have a responsibility to keep the internet-connected software you run up to date and secure!', dom.br(), 'See ', link('https://updates.xmox.nl/changelog'))),
dom.p(
dom.a('Accounts', attr({href: '#accounts'})), dom.br(),
dom.a('Queue', attr({href: '#queue'})), ' ('+queueSize+')', dom.br(),