return livekit server url from api
This commit is contained in:
@@ -119,7 +119,8 @@ type GetLivekitTokenRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetLivekitTokenResponse struct {
|
type GetLivekitTokenResponse struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
|
ServerUrl string `json:"server_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Depot DTOs
|
// Depot DTOs
|
||||||
@@ -1083,7 +1084,7 @@ func (h *Handler) GetLivekitToken(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(GetLivekitTokenResponse{Token: token})
|
json.NewEncoder(w).Encode(GetLivekitTokenResponse{Token: token, ServerUrl: h.livekitClient.ServerUrl()})
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractBearerToken(r *http.Request) string {
|
func extractBearerToken(r *http.Request) string {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
type Client interface {
|
type Client interface {
|
||||||
GetJoinToken(roomId string, identity string) (string, error)
|
GetJoinToken(roomId string, identity string) (string, error)
|
||||||
|
ServerUrl() string
|
||||||
}
|
}
|
||||||
|
|
||||||
type clientImpl struct {
|
type clientImpl struct {
|
||||||
@@ -25,6 +26,10 @@ func NewClient() Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *clientImpl) ServerUrl() string {
|
||||||
|
return c.hostUrl
|
||||||
|
}
|
||||||
|
|
||||||
func (c *clientImpl) GetJoinToken(room, identity string) (string, error) {
|
func (c *clientImpl) GetJoinToken(room, identity string) (string, error) {
|
||||||
at := auth.NewAccessToken(c.apiKey, c.apiSecret)
|
at := auth.NewAccessToken(c.apiKey, c.apiSecret)
|
||||||
grant := &auth.VideoGrant{
|
grant := &auth.VideoGrant{
|
||||||
|
|||||||
Reference in New Issue
Block a user