forked from coracle/flotilla
feature/23-voice-room/poc (#93)
Add voice rooms Co-authored-by: Matt Lorentz <mplorentz@noreply.coracle.social> Co-committed-by: Matt Lorentz <mplorentz@noreply.coracle.social>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
const toHttpUrl = (url: string) =>
|
||||
url
|
||||
.replace(/^wss:\/\//, "https://")
|
||||
.replace(/^ws:\/\//, "http://")
|
||||
.replace(/\/$/, "")
|
||||
|
||||
const livekitEndpoint = (url: string, groupId?: string) => {
|
||||
const base = `${toHttpUrl(url)}/.well-known/nip29/livekit`
|
||||
return groupId ? `${base}/${groupId}` : base
|
||||
}
|
||||
|
||||
export const checkRelayHasLivekit = async (url: string): Promise<boolean> => {
|
||||
const endpoint = livekitEndpoint(url)
|
||||
|
||||
try {
|
||||
const response = await fetch(endpoint)
|
||||
return response.status === 204
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export const getLivekitEndpoint = (url: string, groupId: string) => livekitEndpoint(url, groupId)
|
||||
Reference in New Issue
Block a user