stale/uncommitted

This commit is contained in:
2024-08-27 20:47:29 -04:00
parent 493a5bebc1
commit da674e0ef9
3 changed files with 22 additions and 22 deletions

11
util.py
View File

@ -20,7 +20,7 @@ class Utilities:
logging.error("Rejected request: No such endpoint")
raise HTTPException(detail="Unknown endpoint", status_code=404)
def check_key(self, path: str, key: str):
def check_key(self, path: str, key: str, req_type: int = 0):
"""
Accepts path as an argument to allow fine tuning access for each API key, not currently in use.
"""
@ -36,7 +36,14 @@ class Utilities:
print("Auth failed")
return False
if path.lower().startswith("/xc/") and not(key.startswith("XC-")):
if req_type == 2:
if not key.startswith("PRV-"):
print("Auth failed - not a PRV key")
return False
else:
return True
if path.lower().startswith("/xc/") and not key.startswith("XC-"):
print("Auth failed - not an XC Key")
return False