mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-12-05 22:46:27 +01:00
Update:Only emit library socket events to users with access to lib
This commit is contained in:
1 parent
725f8eecdb
commit
0e292c64c4
3 files changed
+42
-29
No files matched your search
@@ -31,9 +31,13 @@ class SocketAuthority {
|
||||
}
|
||||
|
||||
// Emits event to all authorized clients
|
||||
emitter(evt, data) {
|
||||
// optional filter function to only send event to specific users
|
||||
// TODO: validate that filter is actually a function
|
||||
emitter(evt, data, filter = null) {
|
||||
for (const socketId in this.clients) {
|
||||
if (this.clients[socketId].user) {
|
||||
if (filter && !filter(this.clients[socketId].user)) continue
|
||||
|
||||
this.clients[socketId].socket.emit(evt, data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user