From c7a935777d441d2f8d1de20dfe0f33bf73b73c1f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 16 Jul 2021 19:37:48 +0100 Subject: [PATCH] Fix the jitsi qs parsing, as the `?` after `#` here is optional, unlike in EW --- src/vector/jitsi/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 7d7b05de12..c6385cc478 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -17,7 +17,6 @@ limitations under the License. // We have to trick webpack into loading our CSS for us. require("./index.scss"); -import { parseQs, parseQsFromFragment } from "../url_utils"; import { KJUR } from 'jsrsasign'; import { IOpenIDCredentials, @@ -52,15 +51,16 @@ let meetApi: any; // JitsiMeetExternalAPI (async function() { try { - // The widget's options are encoded into the fragment to avoid leaking info to the server. The widget - // spec on the other hand requires the widgetId and parentUrl to show up in the regular query string. - const widgetQuery = parseQsFromFragment(window.location); - const query = Object.assign({}, parseQs(window.location), widgetQuery.params); + // The widget's options are encoded into the fragment to avoid leaking info to the server. + const widgetQuery = new URLSearchParams(window.location.hash.substring(1)); + // The widget spec on the other hand requires the widgetId and parentUrl to show up in the regular query string. + const realQuery = new URLSearchParams(window.location.search.substring(1)); 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`); } - return query[name]; + return vals[0]; }; // If we have these params, expect a widget API to be available (ie. to be in an iframe