summaryrefslogtreecommitdiff
path: root/backend/main.py
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2025-12-02 16:32:00 +0700
committeraltaf-creator <dev@altafcreator.com>2025-12-02 16:32:00 +0700
commit6f30ea66a89423001228f748dd43b2ee6d331980 (patch)
treec0fe568e60dc033f24238d7714e7c9870a83cf74 /backend/main.py
parent10382a1985dae5afd13c1bda10b43ffbfeda209b (diff)
fixes for info
Diffstat (limited to 'backend/main.py')
-rw-r--r--backend/main.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/backend/main.py b/backend/main.py
index 95a61dd..a27c661 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -394,14 +394,19 @@ def uri_to_information(data: InformationRequestData, response: fastapi.Response,
response.status_code = fastapi.status.HTTP_404_NOT_FOUND
return "INVALID machine ID/URI"
+ print(auth_block)
if auth_block:
- if auth_block != info[0]:
- response.status_code = fastapi.status.HTTP_403_FORBIDDEN
- return "UNAUTHORISED to view information"
- if not info:
+ if info:
+ if auth_block != info[0]:
+ response.status_code = fastapi.status.HTTP_403_FORBIDDEN
+ return "UNAUTHORISED to view information"
+ else:
info = [auth_block, None]
-
else:
- authenticate_block(response, block=info[0])
+ if info:
+ authenticate_block(response, block=info[0])
+ else:
+ response.status_code = fastapi.status.HTTP_401_UNAUTHORIZED
+ return "NO INFORMATION PROVIDED. NO AUTH COOKIE."
return {"block": info[0], "machine": info[1]}