Fix NFC controller auth and document breadboard wiring

This commit is contained in:
Dorian
2026-05-20 14:42:41 -05:00
parent 0068c56bf3
commit 496cf8e9d6
5 changed files with 269 additions and 4 deletions

View File

@@ -1536,7 +1536,10 @@ const handleApi = async (req, res) => {
if (!privilegedConnectionAllowed(req)) return json(res, 404, { error: 'Controller access is only available from the local connection.' })
const controllerAuthed = hasControllerAuth(req)
const isAdmin = (req.headers.authorization || '').startsWith('Bearer ')
if (!controllerAuthed && (!isAdmin || !requireAdmin(req, res))) return
if (!controllerAuthed) {
if (!isAdmin) return json(res, 401, { error: 'Controller token is required.' })
if (!requireAdmin(req, res)) return
}
const body = await readBody(req)
const doorId = cleanText(body.doorId, 80) || 'front-door'
const cardCredential = cleanText(body.cardCredential || body.uid, 160)