Promoted from the door-portal scratch repo to its own repo for install via the aiolabs catalog. Authenticates a tapped Bolt Card via boltcards /verify, authorizes against per-door grants, and fires the door's local Home Assistant webhook to unlock a Z-Wave lock. Fails closed; logs every attempt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
18 lines
596 B
Python
18 lines
596 B
Python
from fastapi import APIRouter, Depends, Request
|
|
from fastapi.responses import HTMLResponse
|
|
from lnbits.core.models import User
|
|
from lnbits.decorators import check_user_exists
|
|
from lnbits.helpers import template_renderer
|
|
|
|
access_generic_router = APIRouter()
|
|
|
|
|
|
def access_renderer():
|
|
return template_renderer(["access/templates"])
|
|
|
|
|
|
@access_generic_router.get("/", response_class=HTMLResponse)
|
|
async def index(request: Request, user: User = Depends(check_user_exists)):
|
|
return access_renderer().TemplateResponse(
|
|
"access/index.html", {"request": request, "user": user.json()}
|
|
)
|