From ddadbf64fec17bf3210abdaae974e646fa9cef8e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 26 Mar 2024 16:27:11 +0000 Subject: [PATCH] Allow popping out a Jitsi widget to respect Desktop `web_base_url` config (#12376) * Allow popping out a Jitsi widget to respect Desktop `web_base_url` config Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/utils/WidgetUtils.ts | 2 +- test/utils/WidgetUtils-test.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/WidgetUtils.ts b/src/utils/WidgetUtils.ts index a0bb8d57e2..3272a14e4e 100644 --- a/src/utils/WidgetUtils.ts +++ b/src/utils/WidgetUtils.ts @@ -521,7 +521,7 @@ export default class WidgetUtils { // safe to send. // We'll end up using a local render URL when we see a Jitsi widget anyways, so this is // really just for backwards compatibility and to appease the spec. - baseUrl = "https://app.element.io/"; + baseUrl = PlatformPeg.get()!.baseUrl; } const url = new URL("jitsi.html#" + queryString, baseUrl); // this strips hash fragment from baseUrl return url.href; diff --git a/test/utils/WidgetUtils-test.ts b/test/utils/WidgetUtils-test.ts index b2034532fc..0fc5df80a5 100644 --- a/test/utils/WidgetUtils-test.ts +++ b/test/utils/WidgetUtils-test.ts @@ -19,6 +19,15 @@ import WidgetUtils from "../../src/utils/WidgetUtils"; import { mockPlatformPeg } from "../test-utils"; describe("getLocalJitsiWrapperUrl", () => { + beforeEach(() => { + Object.defineProperty(window, "location", { + value: { + origin: "https://app.element.io", + pathname: "", + }, + }); + }); + it("should generate jitsi URL (for defaults)", () => { mockPlatformPeg();