@@ -646,21 +646,36 @@ impl Message {
646
646
// add room to a webrtc_instance as defined by the corresponding config-value;
647
647
// the result may still be prefixed by the type
648
648
pub fn create_webrtc_instance ( instance : & str , room : & str ) -> String {
649
- if instance. contains ( "$ROOM" ) {
650
- instance. replace ( "$ROOM" , & room)
649
+ let ( videochat_type, mut url) = Message :: parse_webrtc_instance ( instance) ;
650
+
651
+ // make sure, there is a scheme in the url
652
+ if !url. contains ( ":" ) {
653
+ url = format ! ( "https://{}" , url) ;
654
+ }
655
+
656
+ // add/replace room
657
+ let url = if url. contains ( "$ROOM" ) {
658
+ url. replace ( "$ROOM" , & room)
651
659
} else {
652
- // if there nothing that would separate the room, add a slash as a separator
660
+ // if there nothing that would separate the room, add a slash as a separator;
653
661
// this way, urls can be given as "https://meet.jit.si" as well as "https://meet.jit.si/"
654
- let maybe_slash = if instance . ends_with ( "/" )
655
- || instance . ends_with ( "?" )
656
- || instance . ends_with ( "#" )
657
- || instance . ends_with ( "=" )
662
+ let maybe_slash = if url . ends_with ( "/" )
663
+ || url . ends_with ( "?" )
664
+ || url . ends_with ( "#" )
665
+ || url . ends_with ( "=" )
658
666
{
659
667
""
660
668
} else {
661
669
"/"
662
670
} ;
663
- format ! ( "{}{}{}" , instance, maybe_slash, room)
671
+ format ! ( "{}{}{}" , url, maybe_slash, room)
672
+ } ;
673
+
674
+ // re-add and normalize type
675
+ match videochat_type {
676
+ VideochatType :: BasicWebrtc => format ! ( "basicwebrtc:{}" , url) ,
677
+ VideochatType :: Jitsi => format ! ( "jitsi:{}" , url) ,
678
+ _ => url,
664
679
}
665
680
}
666
681
0 commit comments