allow path segments in url

(allow server uris hosted not at the root)
This commit is contained in:
Hiroshi Horie
2021-10-24 02:18:26 +09:00
parent 6a43f3394c
commit 45a8667aa6
+12 -1
View File
@@ -28,10 +28,21 @@ class Utils {
final useSecure = uri.isSecureScheme || forceSecure;
final httpScheme = useSecure ? 'https' : 'http';
final wsScheme = useSecure ? 'wss' : 'ws';
final lastSegment = validate ? 'validate' : 'rtc';
final pathSegments = List<String>.from(uri.pathSegments);
// strip path segment used for LiveKit if already exists
pathSegments.removeWhere((e) => e.isEmpty);
if (pathSegments.isNotEmpty &&
['rtc', 'validate'].contains(uri.pathSegments.last)) {
pathSegments.removeLast();
}
pathSegments.add(lastSegment);
return uri.replace(
scheme: validate ? httpScheme : wsScheme,
path: validate ? 'validate' : 'rtc',
pathSegments: pathSegments,
queryParameters: <String, String>{
'access_token': token,
if (options != null)