Fix the jitsi qs parsing, as the `?` after `#` here is optional, unlike in EW
parent
26fef6f294
commit
c7a935777d
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||||
// We have to trick webpack into loading our CSS for us.
|
// We have to trick webpack into loading our CSS for us.
|
||||||
require("./index.scss");
|
require("./index.scss");
|
||||||
|
|
||||||
import { parseQs, parseQsFromFragment } from "../url_utils";
|
|
||||||
import { KJUR } from 'jsrsasign';
|
import { KJUR } from 'jsrsasign';
|
||||||
import {
|
import {
|
||||||
IOpenIDCredentials,
|
IOpenIDCredentials,
|
||||||
|
@ -52,15 +51,16 @@ let meetApi: any; // JitsiMeetExternalAPI
|
||||||
|
|
||||||
(async function() {
|
(async function() {
|
||||||
try {
|
try {
|
||||||
// The widget's options are encoded into the fragment to avoid leaking info to the server. The widget
|
// The widget's options are encoded into the fragment to avoid leaking info to the server.
|
||||||
// spec on the other hand requires the widgetId and parentUrl to show up in the regular query string.
|
const widgetQuery = new URLSearchParams(window.location.hash.substring(1));
|
||||||
const widgetQuery = parseQsFromFragment(window.location);
|
// The widget spec on the other hand requires the widgetId and parentUrl to show up in the regular query string.
|
||||||
const query = Object.assign({}, parseQs(window.location), widgetQuery.params);
|
const realQuery = new URLSearchParams(window.location.search.substring(1));
|
||||||
const qsParam = (name: string, optional = false): string => {
|
const qsParam = (name: string, optional = false): string => {
|
||||||
if (!optional && (!query[name] || typeof (query[name]) !== 'string')) {
|
const vals = widgetQuery.has(name) ? widgetQuery.getAll(name) : realQuery.getAll(name);
|
||||||
|
if (!optional && vals.length !== 1) {
|
||||||
throw new Error(`Expected singular ${name} in query string`);
|
throw new Error(`Expected singular ${name} in query string`);
|
||||||
}
|
}
|
||||||
return <string>query[name];
|
return <string>vals[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
// If we have these params, expect a widget API to be available (ie. to be in an iframe
|
// If we have these params, expect a widget API to be available (ie. to be in an iframe
|
||||||
|
|
Loading…
Reference in New Issue