From a961f170d9d386ff0cb77e106e73842bcc2b0127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 5 Sep 2023 17:41:58 +0300 Subject: [PATCH] Fix swipe reporting --- app/doorboy-proxy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/doorboy-proxy.py b/app/doorboy-proxy.py index 26e5492..acf6f29 100755 --- a/app/doorboy-proxy.py +++ b/app/doorboy-proxy.py @@ -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: