Fix a few things with livekit implementation
This commit is contained in:
+1
-1
@@ -326,7 +326,7 @@ func (g *GroupStore) CheckWrite(event nostr.Event) string {
|
|||||||
!slices.Contains(nip29.ModerationEventKinds, event.Kind) &&
|
!slices.Contains(nip29.ModerationEventKinds, event.Kind) &&
|
||||||
event.Kind != nostr.KindSimpleGroupJoinRequest &&
|
event.Kind != nostr.KindSimpleGroupJoinRequest &&
|
||||||
event.Kind != nostr.KindSimpleGroupLeaveRequest &&
|
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"
|
return "blocked: this group does not allow text events"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-2
@@ -48,8 +48,10 @@ func generateLivekitServerToken(apiKey, apiSecret string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ensureLivekitRoom(apiKey, apiSecret, serverURL, roomName string) error {
|
func ensureLivekitRoom(apiKey, apiSecret, serverURL, roomName string) error {
|
||||||
|
roomKey := serverURL + "'" + roomName
|
||||||
|
|
||||||
livekitRoomsMu.RLock()
|
livekitRoomsMu.RLock()
|
||||||
if livekitRooms[roomName] {
|
if livekitRooms[roomKey] {
|
||||||
livekitRoomsMu.RUnlock()
|
livekitRoomsMu.RUnlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -78,7 +80,7 @@ func ensureLivekitRoom(apiKey, apiSecret, serverURL, roomName string) error {
|
|||||||
|
|
||||||
if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusConflict {
|
if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusConflict {
|
||||||
livekitRoomsMu.Lock()
|
livekitRoomsMu.Lock()
|
||||||
livekitRooms[roomName] = true
|
livekitRooms[roomKey] = true
|
||||||
livekitRoomsMu.Unlock()
|
livekitRoomsMu.Unlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -109,6 +111,11 @@ func (instance *Instance) livekitTokenHandler(w http.ResponseWriter, r *http.Req
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !instance.Management.IsMember(pubkey) {
|
||||||
|
http.Error(w, "not a member of this relay", http.StatusForbidden)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
meta, found := instance.Groups.GetMetadata(groupId)
|
meta, found := instance.Groups.GetMetadata(groupId)
|
||||||
if !found {
|
if !found {
|
||||||
http.Error(w, "group not found", http.StatusNotFound)
|
http.Error(w, "group not found", http.StatusNotFound)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
RELAY_ADD_MEMBER = 8000
|
RELAY_ADD_MEMBER = 8000
|
||||||
RELAY_REMOVE_MEMBER = 8001
|
RELAY_REMOVE_MEMBER = 8001
|
||||||
|
ROOM_PRESENCE = 10312
|
||||||
RELAY_MEMBERS = 13534
|
RELAY_MEMBERS = 13534
|
||||||
RELAY_JOIN = 28934
|
RELAY_JOIN = 28934
|
||||||
RELAY_INVITE = 28935
|
RELAY_INVITE = 28935
|
||||||
|
|||||||
Reference in New Issue
Block a user