mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
hiding websocket initalization behind authentication
This commit is contained in:
@@ -80,8 +80,8 @@ async def get_session_user(
|
||||
auth_header = request.headers.get("Authorization")
|
||||
auth_token = get_http_authorization_cred(auth_header)
|
||||
token = auth_token.credentials
|
||||
|
||||
data = decode_token(token)
|
||||
|
||||
expires_at = data.get("exp")
|
||||
|
||||
if int(time.time()) > expires_at:
|
||||
|
||||
@@ -192,6 +192,9 @@ async def connect(sid, environ, auth):
|
||||
# print(f"user {user.name}({user.id}) connected with session ID {sid}")
|
||||
await sio.emit("user-list", {"user_ids": list(USER_POOL.keys())})
|
||||
await sio.emit("usage", {"models": get_models_in_use()})
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@sio.on("user-join")
|
||||
|
||||
Reference in New Issue
Block a user