fix: utf-8 room name case sensitivity
This commit is contained in:
parent
34a71042c6
commit
13d78d6b49
|
@ -15,6 +15,7 @@ import { connect, disconnect, setLocationURL } from '../base/connection';
|
||||||
import { loadConfig } from '../base/lib-jitsi-meet';
|
import { loadConfig } from '../base/lib-jitsi-meet';
|
||||||
import { createDesiredLocalTracks } from '../base/tracks';
|
import { createDesiredLocalTracks } from '../base/tracks';
|
||||||
import {
|
import {
|
||||||
|
getBackendSafeRoomName,
|
||||||
getLocationContextRoot,
|
getLocationContextRoot,
|
||||||
parseURIString,
|
parseURIString,
|
||||||
toURLString
|
toURLString
|
||||||
|
@ -85,7 +86,7 @@ export function appNavigate(uri: ?string) {
|
||||||
let url = `${baseURL}config.js`;
|
let url = `${baseURL}config.js`;
|
||||||
|
|
||||||
// XXX In order to support multiple shards, tell the room to the deployment.
|
// XXX In order to support multiple shards, tell the room to the deployment.
|
||||||
room && (url += `?room=${room.toLowerCase()}`);
|
room && (url += `?room=${getBackendSafeRoomName(room)}`);
|
||||||
|
|
||||||
let config;
|
let config;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,10 @@ import {
|
||||||
participantUpdated
|
participantUpdated
|
||||||
} from '../participants';
|
} from '../participants';
|
||||||
import { getLocalTracks, trackAdded, trackRemoved } from '../tracks';
|
import { getLocalTracks, trackAdded, trackRemoved } from '../tracks';
|
||||||
import { getJitsiMeetGlobalNS } from '../util';
|
import {
|
||||||
|
getBackendSafeRoomName,
|
||||||
|
getJitsiMeetGlobalNS
|
||||||
|
} from '../util';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AUTH_STATUS_CHANGED,
|
AUTH_STATUS_CHANGED,
|
||||||
|
@ -388,8 +391,7 @@ export function createConference() {
|
||||||
const conference
|
const conference
|
||||||
= connection.initJitsiConference(
|
= connection.initJitsiConference(
|
||||||
|
|
||||||
// XXX Lib-jitsi-meet does not accept uppercase letters.
|
getBackendSafeRoomName(room), {
|
||||||
room.toLowerCase(), {
|
|
||||||
...state['features/base/config'],
|
...state['features/base/config'],
|
||||||
applicationName: getName(),
|
applicationName: getName(),
|
||||||
getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats,
|
getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/* @flow */
|
/* @flow */
|
||||||
|
|
||||||
|
import { getBackendSafeRoomName } from '../util';
|
||||||
|
|
||||||
declare var config: Object;
|
declare var config: Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,10 +22,8 @@ export default function getRoomName(): ?string {
|
||||||
// URL maps to the room (name). It currently assumes a deployment in
|
// URL maps to the room (name). It currently assumes a deployment in
|
||||||
// which the last non-directory component of the path (name) is the
|
// which the last non-directory component of the path (name) is the
|
||||||
// room.
|
// room.
|
||||||
roomName
|
roomName = path.substring(path.lastIndexOf('/') + 1) || undefined;
|
||||||
= path.substring(path.lastIndexOf('/') + 1).toLowerCase()
|
|
||||||
|| undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return roomName;
|
return getBackendSafeRoomName(roomName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@ import {
|
||||||
getCurrentConference
|
getCurrentConference
|
||||||
} from '../conference';
|
} from '../conference';
|
||||||
import JitsiMeetJS, { JitsiConnectionEvents } from '../lib-jitsi-meet';
|
import JitsiMeetJS, { JitsiConnectionEvents } from '../lib-jitsi-meet';
|
||||||
import { parseURIString } from '../util';
|
import {
|
||||||
|
getBackendSafeRoomName,
|
||||||
|
parseURIString
|
||||||
|
} from '../util';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CONNECTION_DISCONNECTED,
|
CONNECTION_DISCONNECTED,
|
||||||
|
@ -307,10 +310,7 @@ function _constructOptions(state) {
|
||||||
// Append room to the URL's search.
|
// Append room to the URL's search.
|
||||||
const { room } = state['features/base/conference'];
|
const { room } = state['features/base/conference'];
|
||||||
|
|
||||||
// XXX The Jitsi Meet deployments require the room argument to be in
|
room && (bosh += `?room=${getBackendSafeRoomName(room)}`);
|
||||||
// lower case at the time of this writing but, unfortunately, they do
|
|
||||||
// not ignore case themselves.
|
|
||||||
room && (bosh += `?room=${room.toLowerCase()}`);
|
|
||||||
|
|
||||||
options.bosh = bosh;
|
options.bosh = bosh;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ declare var APP: Object;
|
||||||
declare var config: Object;
|
declare var config: Object;
|
||||||
|
|
||||||
import { configureInitialDevices } from '../devices';
|
import { configureInitialDevices } from '../devices';
|
||||||
|
import { getBackendSafeRoomName } from '../util';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
connectionEstablished,
|
connectionEstablished,
|
||||||
|
@ -21,8 +22,7 @@ import logger from './logger';
|
||||||
*/
|
*/
|
||||||
export function connect() {
|
export function connect() {
|
||||||
return (dispatch: Dispatch<any>, getState: Function) => {
|
return (dispatch: Dispatch<any>, getState: Function) => {
|
||||||
// XXX Lib-jitsi-meet does not accept uppercase letters.
|
const room = getBackendSafeRoomName(getState()['features/base/conference'].room);
|
||||||
const room = getState()['features/base/conference'].room.toLowerCase();
|
|
||||||
|
|
||||||
// XXX For web based version we use conference initialization logic
|
// XXX For web based version we use conference initialization logic
|
||||||
// from the old app (at the moment of writing).
|
// from the old app (at the moment of writing).
|
||||||
|
|
|
@ -96,6 +96,47 @@ function _fixURIStringScheme(uri: string) {
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a room name to a backend-safe format. Properly lowercased and url encoded.
|
||||||
|
*
|
||||||
|
* @param {string?} room - The room name to convert.
|
||||||
|
* @returns {string?}
|
||||||
|
*/
|
||||||
|
export function getBackendSafeRoomName(room: ?string): ?string {
|
||||||
|
if (!room) {
|
||||||
|
return room;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* eslint-disable no-param-reassign */
|
||||||
|
try {
|
||||||
|
// We do not know if we get an already encoded string at this point
|
||||||
|
// as different platforms do it differently, but we need a decoded one
|
||||||
|
// for sure. However since decoding a non-encoded string is a noop, we're safe
|
||||||
|
// doing it here.
|
||||||
|
room = decodeURIComponent(room);
|
||||||
|
} catch (e) {
|
||||||
|
// This can happen though if we get an unencoded string and it contains
|
||||||
|
// some characters that look like an encoded entity, but it's not.
|
||||||
|
// But in this case we're fine goin on...
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize the character set
|
||||||
|
room = room.normalize('NFKC');
|
||||||
|
|
||||||
|
// Only decoded and normalized strings can be lowercased properly.
|
||||||
|
room = room.toLowerCase();
|
||||||
|
|
||||||
|
// But we still need to (re)encode it.
|
||||||
|
room = encodeURIComponent(room);
|
||||||
|
/* eslint-enable no-param-reassign */
|
||||||
|
|
||||||
|
// Unfortunately we still need to lowercase it, because encoding a string will
|
||||||
|
// add some uppercase characters, but some backend services
|
||||||
|
// expect it to be full lowercase. However lowercasing an encoded string
|
||||||
|
// doesn't change the string value.
|
||||||
|
return room.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the (Web application) context root defined by a specific location (URI).
|
* Gets the (Web application) context root defined by a specific location (URI).
|
||||||
*
|
*
|
||||||
|
|
|
@ -192,7 +192,7 @@ export class AbstractWelcomePage extends Component<Props, *> {
|
||||||
const onAppNavigateSettled
|
const onAppNavigateSettled
|
||||||
= () => this._mounted && this.setState({ joining: false });
|
= () => this._mounted && this.setState({ joining: false });
|
||||||
|
|
||||||
this.props.dispatch(appNavigate(encodeURI(room)))
|
this.props.dispatch(appNavigate(room))
|
||||||
.then(onAppNavigateSettled, onAppNavigateSettled);
|
.then(onAppNavigateSettled, onAppNavigateSettled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue