Fix swipe reporting
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
043653760e
commit
a961f170d9
@ -91,12 +91,13 @@ async def forward_swipe(request):
|
|||||||
if not key or key not in [DOORBOY_SECRET_FLOOR, DOORBOY_SECRET_WORKSHOP]:
|
if not key or key not in [DOORBOY_SECRET_FLOOR, DOORBOY_SECRET_WORKSHOP]:
|
||||||
return text("Invalid token", status=401)
|
return text("Invalid token", status=401)
|
||||||
data = request.json
|
data = request.json
|
||||||
doors = []
|
doors = set()
|
||||||
if key == DOORBOY_SECRET_FLOOR:
|
if key == DOORBOY_SECRET_FLOOR:
|
||||||
doors.extend(["backdoor, frontdoor, grounddoor"])
|
doors.update(["backdoor", "frontdoor", "grounddoor"])
|
||||||
if key == DOORBOY_SECRET_WORKSHOP:
|
if key == DOORBOY_SECRET_WORKSHOP:
|
||||||
doors.append("workshopdoor")
|
doors.add("workshopdoor")
|
||||||
if data.get("door") not in doors:
|
if data.get("door") not in doors:
|
||||||
|
print("Door", repr(data.get("door")), "not in", doors)
|
||||||
return text("Not allowed", 403)
|
return text("Not allowed", 403)
|
||||||
|
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
|
Loading…
Reference in New Issue
Block a user