Public Access
Visitor sign in kiosk: multi-site, badge printing, WWCC expiry warnings, admin accounts with 2FA
This commit is contained in:
@@ -6,6 +6,7 @@ import { savePhoto, photoAbsolutePath, copyStoredPhoto } from '../photos.js';
|
||||
import { mirror } from '../sheets.js';
|
||||
import { verifyPin } from '../pins.js';
|
||||
import { listSites, resolveSite, badgeHtml } from '../sites.js';
|
||||
import { themeFor, bannerAbsolutePath } from '../branding.js';
|
||||
import fs from 'node:fs';
|
||||
import {
|
||||
clean,
|
||||
@@ -47,9 +48,24 @@ router.get('/config', (req, res) => {
|
||||
: null,
|
||||
siteName: site ? site.name : config.siteName,
|
||||
requirePhoto: config.requirePhoto,
|
||||
// Branding for this kiosk: colours are applied as CSS variables and the
|
||||
// banner replaces the site name in the top bar.
|
||||
theme: themeFor(site),
|
||||
banner: site?.banner_path
|
||||
? { url: `/api/branding/${site.id}/banner`, height: site.banner_height || 64 }
|
||||
: null,
|
||||
});
|
||||
});
|
||||
|
||||
/** The site banner. Public, because the kiosk shows it before anyone signs in. */
|
||||
router.get('/branding/:id/banner', (req, res) => {
|
||||
const site = db.prepare('SELECT banner_path FROM sites WHERE id = ?').get(req.params.id);
|
||||
const abs = site && bannerAbsolutePath(site.banner_path);
|
||||
if (!abs) return res.status(404).send('No banner set.');
|
||||
res.setHeader('Cache-Control', 'public, max-age=300');
|
||||
res.sendFile(abs);
|
||||
});
|
||||
|
||||
router.get('/hosts', (req, res) => {
|
||||
const site = siteFrom(req);
|
||||
if (!site) return res.json([]);
|
||||
|
||||
Reference in New Issue
Block a user