Visitor sign in kiosk: multi-site, badge printing, WWCC expiry warnings, admin accounts with 2FA

This commit is contained in:
2026-09-02 16:45:48 +10:00
parent ff9f51eaf9
commit 8c97c314e0
11 changed files with 211 additions and 247 deletions
+6 -14
View File
@@ -388,8 +388,8 @@ router.patch('/sites/:id', (req, res) => {
db.prepare(
`UPDATE sites SET name = ?, slug = ?, active = ?, badge_enabled = ?, badge_width_mm = ?,
badge_height_mm = ?, badge_show_photo = ?, badge_accent = ?, badge_note = ?,
colour_brand = ?, colour_signout = ?, colour_page = ?, banner_height = ?,
banner_align = ? WHERE id = ?`
colour_brand = ?, colour_signout = ?, colour_page = ?, colour_text = ?,
banner_height = ?, banner_align = ? WHERE id = ?`
).run(
clean(req.body?.name ?? site.name, 100) || site.name,
req.body?.slug ? uniqueSlug(req.body.slug, site.id) : site.slug,
@@ -409,6 +409,7 @@ router.patch('/sites/:id', (req, res) => {
? normaliseColour(branding.signout, null)
: site.colour_signout,
branding.page !== undefined ? normaliseColour(branding.page, null) : site.colour_page,
branding.text !== undefined ? normaliseColour(branding.text, null) : site.colour_text,
branding.bannerHeight !== undefined
? Math.min(200, Math.max(24, Number(branding.bannerHeight) || 64))
: site.banner_height,
@@ -953,7 +954,7 @@ router.post('/visits/:id/signout', (req, res) => {
'admin',
visit.id
);
sheets.mirror(db.prepare('SELECT * FROM visits WHERE id = ?').get(visit.id), 'SIGN OUT');
sheets.mirror();
res.json({ ok: true });
});
@@ -1100,11 +1101,10 @@ router.get('/status', (req, res) => {
: db.prepare('SELECT COUNT(*) AS n FROM visits WHERE signed_out_at IS NULL').get().n,
sheets: {
enabled: sheets.isEnabled(),
queued: sheets.queueDepth(),
lastOk: sheets.status.lastOk,
lastError: sheets.status.lastError,
logTab: config.sheets.logTab,
onSiteTab: config.sheets.onSiteTab,
tab: sheets.tabName(),
stale: sheets.isStale(),
lastOnSiteSync: sheets.status.lastOnSiteSync,
onSiteCount: sheets.status.onSiteCount,
onSiteError: sheets.status.onSiteError,
@@ -1129,14 +1129,6 @@ router.post('/sheets/test', async (req, res) => {
}
});
router.post('/sheets/flush', async (req, res) => {
try {
res.json(await sheets.flushQueue());
} catch (err) {
res.status(400).json({ error: err.message });
}
});
/* ---------------------------------------------------------------- tls */
router.get('/tls', (req, res) => {