Fix swipe reporting
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Lauri Võsandi 2023-09-05 17:41:58 +03:00
parent 043653760e
commit a961f170d9
1 changed files with 4 additions and 3 deletions

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: