mirror of
https://github.com/strukturag/nextcloud-spreed-signaling.git
synced 2023-10-21 07:33:40 -05:00
Only allow subscribing if both users are in the same room and call.
Previously it was possible to subscribe any stream if the session id of the publisher was known.
This commit is contained in:
@@ -159,6 +159,28 @@ func (r *Room) Backend() *Backend {
|
||||
return r.backend
|
||||
}
|
||||
|
||||
func (r *Room) IsEqual(other *Room) bool {
|
||||
if r == other {
|
||||
return true
|
||||
} else if other == nil {
|
||||
return false
|
||||
} else if r.Id() != other.Id() {
|
||||
return false
|
||||
}
|
||||
|
||||
b1 := r.Backend()
|
||||
b2 := other.Backend()
|
||||
if b1 == b2 {
|
||||
return true
|
||||
} else if b1 == nil && b2 != nil {
|
||||
return false
|
||||
} else if b1 != nil && b2 == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return b1.Id() == b2.Id()
|
||||
}
|
||||
|
||||
func (r *Room) run() {
|
||||
ticker := time.NewTicker(updateActiveSessionsInterval)
|
||||
loop:
|
||||
@@ -320,6 +342,13 @@ func (r *Room) HasSession(session Session) bool {
|
||||
return result
|
||||
}
|
||||
|
||||
func (r *Room) IsSessionInCall(session Session) bool {
|
||||
r.mu.RLock()
|
||||
_, result := r.inCallSessions[session]
|
||||
r.mu.RUnlock()
|
||||
return result
|
||||
}
|
||||
|
||||
// Returns "true" if there are still clients in the room.
|
||||
func (r *Room) RemoveSession(session Session) bool {
|
||||
r.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user