mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
Merge pull request #17175 from garylab/bugfix/api-config
Bugfix: Add verify token from headers also for /api/config endpoint
This commit is contained in:
commit
e5829572ff
1 changed files with 11 additions and 1 deletions
|
|
@ -1649,8 +1649,18 @@ async def list_tasks_by_chat_id_endpoint(
|
||||||
@app.get("/api/config")
|
@app.get("/api/config")
|
||||||
async def get_app_config(request: Request):
|
async def get_app_config(request: Request):
|
||||||
user = None
|
user = None
|
||||||
if "token" in request.cookies:
|
token = None
|
||||||
|
|
||||||
|
auth_header = request.headers.get("Authorization")
|
||||||
|
if auth_header:
|
||||||
|
cred = get_http_authorization_cred(auth_header)
|
||||||
|
if cred:
|
||||||
|
token = cred.credentials
|
||||||
|
|
||||||
|
if not token and "token" in request.cookies:
|
||||||
token = request.cookies.get("token")
|
token = request.cookies.get("token")
|
||||||
|
|
||||||
|
if token:
|
||||||
try:
|
try:
|
||||||
data = decode_token(token)
|
data = decode_token(token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue