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.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user