|
@@ -6,6 +6,13 @@
|
6
|
6
|
*/
|
7
|
7
|
export const APP_LINK_SCHEME = 'org.jitsi.meet:';
|
8
|
8
|
|
|
9
|
+/**
|
|
10
|
+ * A list of characters to be excluded/removed from the room component/segment
|
|
11
|
+ * of a conference/meeting URI/URL. The list is based on RFC 3986 and the jxmpp
|
|
12
|
+ * library utilized by jicofo.
|
|
13
|
+ */
|
|
14
|
+const _ROOM_EXCLUDE_PATTERN = '[\\:\\?#\\[\\]@!$&\'()*+,;=></"]';
|
|
15
|
+
|
9
|
16
|
/**
|
10
|
17
|
* The {@link RegExp} pattern of the authority of a URI.
|
11
|
18
|
*
|
|
@@ -34,6 +41,20 @@ const _URI_PATH_PATTERN = '([^?#]*)';
|
34
|
41
|
*/
|
35
|
42
|
export const URI_PROTOCOL_PATTERN = '([a-z][a-z0-9\\.\\+-]*:)';
|
36
|
43
|
|
|
44
|
+/**
|
|
45
|
+ * Excludes/removes certain characters from a specific room (name) which are
|
|
46
|
+ * incompatible with Jitsi Meet on the client and/or server sides.
|
|
47
|
+ *
|
|
48
|
+ * @param {?string} room - The room (name) to fix.
|
|
49
|
+ * @private
|
|
50
|
+ * @returns {?string}
|
|
51
|
+ */
|
|
52
|
+function _fixRoom(room: ?string) {
|
|
53
|
+ return room
|
|
54
|
+ ? room.replace(new RegExp(_ROOM_EXCLUDE_PATTERN, 'g'), '')
|
|
55
|
+ : room;
|
|
56
|
+}
|
|
57
|
+
|
37
|
58
|
/**
|
38
|
59
|
* Fixes the hier-part of a specific URI (string) so that the URI is well-known.
|
39
|
60
|
* For example, certain Jitsi Meet deployments are not conventional but it is
|
|
@@ -295,10 +316,27 @@ export function parseURIString(uri: ?string) {
|
295
|
316
|
// contextRoot
|
296
|
317
|
obj.contextRoot = getLocationContextRoot(obj);
|
297
|
318
|
|
298
|
|
- // The room (name) is the last component of pathname.
|
|
319
|
+ // The room (name) is the last component/segment of pathname.
|
299
|
320
|
const { pathname } = obj;
|
300
|
321
|
|
301
|
|
- obj.room = pathname.substring(pathname.lastIndexOf('/') + 1) || undefined;
|
|
322
|
+ // XXX While the components/segments of pathname are URI encoded, Jitsi Meet
|
|
323
|
+ // on the client and/or server sides still don't support certain characters.
|
|
324
|
+ const contextRootEndIndex = pathname.lastIndexOf('/');
|
|
325
|
+ let room = pathname.substring(contextRootEndIndex + 1) || undefined;
|
|
326
|
+
|
|
327
|
+ if (room) {
|
|
328
|
+ const fixedRoom = _fixRoom(room);
|
|
329
|
+
|
|
330
|
+ if (fixedRoom !== room) {
|
|
331
|
+ room = fixedRoom;
|
|
332
|
+
|
|
333
|
+ // XXX Drive fixedRoom into pathname (because room is derived from
|
|
334
|
+ // pathname).
|
|
335
|
+ obj.pathname
|
|
336
|
+ = pathname.substring(0, contextRootEndIndex + 1) + (room || '');
|
|
337
|
+ }
|
|
338
|
+ }
|
|
339
|
+ obj.room = room;
|
302
|
340
|
|
303
|
341
|
return obj;
|
304
|
342
|
}
|