mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
fix
This commit is contained in:
parent
689b910c77
commit
b4d7268bed
@ -193,6 +193,27 @@ async def user_join(sid, data):
|
|||||||
await sio.emit("user-count", {"count": len(USER_POOL.items())})
|
await sio.emit("user-count", {"count": len(USER_POOL.items())})
|
||||||
|
|
||||||
|
|
||||||
|
@sio.on("join-channels")
|
||||||
|
async def join_channel(sid, data):
|
||||||
|
auth = data["auth"] if "auth" in data else None
|
||||||
|
if not auth or "token" not in auth:
|
||||||
|
return
|
||||||
|
|
||||||
|
data = decode_token(auth["token"])
|
||||||
|
if data is None or "id" not in data:
|
||||||
|
return
|
||||||
|
|
||||||
|
user = Users.get_user_by_id(data["id"])
|
||||||
|
if not user:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Join all the channels
|
||||||
|
channels = Channels.get_channels_by_user_id(user.id)
|
||||||
|
log.debug(f"{channels=}")
|
||||||
|
for channel in channels:
|
||||||
|
await sio.enter_room(sid, f"channel:{channel.id}")
|
||||||
|
|
||||||
|
|
||||||
@sio.on("user-count")
|
@sio.on("user-count")
|
||||||
async def user_count(sid):
|
async def user_count(sid):
|
||||||
await sio.emit("user-count", {"count": len(USER_POOL.items())})
|
await sio.emit("user-count", {"count": len(USER_POOL.items())})
|
||||||
|
@ -415,6 +415,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
$socket.emit('join-channels', { auth: { token: $user.token } });
|
||||||
await initChannels();
|
await initChannels();
|
||||||
showCreateChannel = false;
|
showCreateChannel = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user