Fix a few things with livekit implementation

This commit is contained in:
Jon Staab
2026-03-06 15:29:10 -08:00
parent 88ac3b9951
commit 43a732eaf3
3 changed files with 11 additions and 3 deletions
+9 -2
View File
@@ -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)