Fix NFC controller auth and document breadboard wiring
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user