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
+1 -1
View File
@@ -326,7 +326,7 @@ func (g *GroupStore) CheckWrite(event nostr.Event) string {
!slices.Contains(nip29.ModerationEventKinds, event.Kind) &&
event.Kind != nostr.KindSimpleGroupJoinRequest &&
event.Kind != nostr.KindSimpleGroupLeaveRequest &&
event.Kind != 10312 /* hardcoded temporarily while NIP is hashed out */ {
event.Kind != ROOM_PRESENCE {
return "blocked: this group does not allow text events"
}
+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)
+1
View File
@@ -15,6 +15,7 @@ import (
const (
RELAY_ADD_MEMBER = 8000
RELAY_REMOVE_MEMBER = 8001
ROOM_PRESENCE = 10312
RELAY_MEMBERS = 13534
RELAY_JOIN = 28934
RELAY_INVITE = 28935