mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-21 14:59:02 +00:00
Tree: Fix extraneous bugs and update T/s print
Model: Add extra information to print and fix the divide by zero error. Auth: Fix validation of API and admin keys to look for the entire key. References #7 and #6 Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
4
auth.py
4
auth.py
@@ -48,7 +48,7 @@ def check_api_key(x_api_key: str = Header(None), authorization: str = Header(Non
|
||||
|
||||
if len(split_key) < 2:
|
||||
raise HTTPException(401, "Invalid API key")
|
||||
elif split_key[0].lower() == "bearer" and split_key[1] in auth_keys.api_key:
|
||||
elif split_key[0].lower() == "bearer" and split_key[1] == auth_keys.api_key:
|
||||
return authorization
|
||||
else:
|
||||
raise HTTPException(401, "Invalid API key")
|
||||
@@ -66,7 +66,7 @@ def check_admin_key(x_admin_key: str = Header(None), authorization: str = Header
|
||||
|
||||
if len(split_key) < 2:
|
||||
raise HTTPException(401, "Invalid admin key")
|
||||
elif split_key[0].lower() == "bearer" and split_key[1] in auth_keys.admin_key:
|
||||
elif split_key[0].lower() == "bearer" and split_key[1] == auth_keys.admin_key:
|
||||
return authorization
|
||||
else:
|
||||
raise HTTPException(401, "Invalid admin key")
|
||||
|
||||
Reference in New Issue
Block a user