add dion for desktop joiner
This commit is contained in:
1 parent
beccc40522
commit
cdfed572f0
12 files changed
+99
-59
No files matched your search
@@ -32,6 +32,28 @@ const (
|
||||
Origin = "https://dion.vc"
|
||||
)
|
||||
|
||||
// ParseRoom accepts a bare room id, a dion://<id> link, or a
|
||||
// https://dion.vc/event/<id> URL and returns the room id. Trailing query
|
||||
// strings and path segments are stripped.
|
||||
func ParseRoom(input string) string {
|
||||
trimmed := strings.TrimSpace(input)
|
||||
if trimmed == "" {
|
||||
return ""
|
||||
}
|
||||
trimmed = strings.TrimPrefix(trimmed, "dion://")
|
||||
trimmed = strings.TrimPrefix(trimmed, "https://")
|
||||
trimmed = strings.TrimPrefix(trimmed, "http://")
|
||||
trimmed = strings.TrimPrefix(trimmed, "dion.vc/")
|
||||
trimmed = strings.TrimPrefix(trimmed, "event/")
|
||||
if idx := strings.Index(trimmed, "?"); idx >= 0 {
|
||||
trimmed = trimmed[:idx]
|
||||
}
|
||||
if idx := strings.Index(trimmed, "/"); idx >= 0 {
|
||||
trimmed = trimmed[:idx]
|
||||
}
|
||||
return trimmed
|
||||
}
|
||||
|
||||
type GuestUser struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
|
||||
@@ -90,6 +90,7 @@ type Call struct {
|
||||
|
||||
OnConnected func(tunnel.DataTunnel)
|
||||
OnPeerRestart func()
|
||||
OnRemoteSDP func(sdp string)
|
||||
|
||||
done chan struct{}
|
||||
closeOnce sync.Once
|
||||
@@ -339,6 +340,9 @@ func (c *Call) Start() error {
|
||||
case <-time.After(20 * time.Second):
|
||||
return fmt.Errorf("timeout waiting for sdp_answer")
|
||||
}
|
||||
if c.OnRemoteSDP != nil {
|
||||
c.OnRemoteSDP(answer.Answer)
|
||||
}
|
||||
if err := peer.PC.SetRemoteDescription(webrtc.SessionDescription{
|
||||
Type: webrtc.SDPTypeAnswer,
|
||||
SDP: answer.Answer,
|
||||
|
||||
Reference in new issue
Block a user