Fix swipe reporting
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Lauri Võsandi 2023-09-05 17:41:58 +03:00
parent 043653760e
commit a961f170d9

View File

@ -91,12 +91,13 @@ async def forward_swipe(request):
if not key or key not in [DOORBOY_SECRET_FLOOR, DOORBOY_SECRET_WORKSHOP]:
return text("Invalid token", status=401)
data = request.json
doors = []
doors = set()
if key == DOORBOY_SECRET_FLOOR:
doors.extend(["backdoor, frontdoor, grounddoor"])
doors.update(["backdoor", "frontdoor", "grounddoor"])
if key == DOORBOY_SECRET_WORKSHOP:
doors.append("workshopdoor")
doors.add("workshopdoor")
if data.get("door") not in doors:
print("Door", repr(data.get("door")), "not in", doors)
return text("Not allowed", 403)
async with httpx.AsyncClient() as client: