Fix a few things with livekit implementation
This commit is contained in:
+9
-2
@@ -48,8 +48,10 @@ func generateLivekitServerToken(apiKey, apiSecret string) string {
|
||||
}
|
||||
|
||||
func ensureLivekitRoom(apiKey, apiSecret, serverURL, roomName string) error {
|
||||
roomKey := serverURL + "'" + roomName
|
||||
|
||||
livekitRoomsMu.RLock()
|
||||
if livekitRooms[roomName] {
|
||||
if livekitRooms[roomKey] {
|
||||
livekitRoomsMu.RUnlock()
|
||||
return nil
|
||||
}
|
||||
@@ -78,7 +80,7 @@ func ensureLivekitRoom(apiKey, apiSecret, serverURL, roomName string) error {
|
||||
|
||||
if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusConflict {
|
||||
livekitRoomsMu.Lock()
|
||||
livekitRooms[roomName] = true
|
||||
livekitRooms[roomKey] = true
|
||||
livekitRoomsMu.Unlock()
|
||||
return nil
|
||||
}
|
||||
@@ -109,6 +111,11 @@ func (instance *Instance) livekitTokenHandler(w http.ResponseWriter, r *http.Req
|
||||
return
|
||||
}
|
||||
|
||||
if !instance.Management.IsMember(pubkey) {
|
||||
http.Error(w, "not a member of this relay", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
meta, found := instance.Groups.GetMetadata(groupId)
|
||||
if !found {
|
||||
http.Error(w, "group not found", http.StatusNotFound)
|
||||
|
||||
Reference in New Issue
Block a user