Files
KCal/src/middleware/resolveKiosk.js
T
ort 66b8fc5d4d Add self-hosted kids calendar app
Express + SQLite (node:sqlite, no native build step) family calendar:
parent accounts with household invites, per-child calendars with
save/duplicate/print, a token-gated read-only kiosk view for tablets,
and polling to keep parent and kiosk views in sync. Defaults to port 3007.
2026-08-15 13:48:01 -04:00

16 lines
496 B
JavaScript

const db = require('../db');
const getChildByTokenStmt = db.prepare('SELECT * FROM children WHERE kiosk_token = ?');
function resolveKiosk(req, res, next) {
if (typeof req.params.token !== 'string' || !req.params.token) {
return res.status(404).json({ error: 'Invalid kiosk link' });
}
const child = getChildByTokenStmt.get(req.params.token);
if (!child) return res.status(404).json({ error: 'Invalid kiosk link' });
req.child = child;
next();
}
module.exports = resolveKiosk;