summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/main.py7
-rw-r--r--frontend/main.js2
2 files changed, 7 insertions, 2 deletions
diff --git a/backend/main.py b/backend/main.py
index 9b4ac1c..20078d3 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -386,8 +386,10 @@ def finish_laundry(data: FinishRequestData, response: fastapi.Response, session_
# --- get information from uri search query
@app.post("/info")
def uri_to_information(data: InformationRequestData, response: fastapi.Response, auth_block: Annotated[str | None, fastapi.Cookie()] = None):
+ info = None
try:
- info = URI_TO_MACHINES[data.machine_id]
+ if data.machine_id:
+ info = URI_TO_MACHINES[data.machine_id]
except KeyError:
response.status_code = fastapi.status.HTTP_404_NOT_FOUND
return "INVALID machine ID/URI"
@@ -396,6 +398,9 @@ def uri_to_information(data: InformationRequestData, response: fastapi.Response,
if auth_block != info[0]:
response.status_code = fastapi.status.HTTP_403_FORBIDDEN
return "UNAUTHORISED to view information"
+ if not info:
+ info = [auth_block, None]
+
else:
authenticate_block(response, block=info[0])
diff --git a/frontend/main.js b/frontend/main.js
index 65a1d93..0e084ab 100644
--- a/frontend/main.js
+++ b/frontend/main.js
@@ -74,7 +74,7 @@ async function information(urlParam = null) {
headers: {
"Content-Type": "application/json"
},
- body: JSON.stringify({ "machine_id": urlParam ? urlParam : await cookieStore.get({name: "auth_block", url: API_URL}) })
+ body: JSON.stringify({ "machine_id": urlParam ? urlParam : null }),
});
const block = await response.json()["block"];