Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
refactor(base/config): move buildConfigURL into its own module
Hristo Terezovb3f13f630975
diff --git a/react/features/base/config/buildConfigURL.ts b/react/features/base/config/buildConfigURL.tsnew file mode 100644index 0000000000..19a8637069--- /dev/null+++ b/react/features/base/config/buildConfigURL.ts@@ -0,0 +1,33 @@+import { parseURLParams } from '../util/parseURLParams';+import {+ appendURLParam,+ getNormalizedRoomName,+ parseURIString+} from '../util/uri';++/**+ * Builds the config.js URL for a given location and optional room name.+ * Extracted to avoid duplication between app navigation (native) and shard-change reconnect (web).+ *+ * @param {URL | { href: string }} locationURL - The location URL.+ * @param {string | null | undefined} room - Optional room name to append as a query param.+ * @returns {string} The full config.js URL with room and release params appended as needed.+ */+export function buildConfigURL(locationURL: URL, room?: string | null): string {+ const { protocol, host, contextRoot } = parseURIString(locationURL.href);+ const normalizedProtocol = protocol === 'http:' || protocol === 'https:' ? protocol : 'https:';+ const baseURL = `${normalizedProtocol}//${host}${contextRoot || '/'}`;+ let url = `${baseURL}config.js`;++ if (room) {+ url = appendURLParam(url, 'room', getNormalizedRoomName(room) ?? '');+ }++ const { release } = parseURLParams(locationURL, true, 'search');++ if (release) {+ url = appendURLParam(url, 'release', release as string);+ }++ return url;+}diff --git a/react/features/base/config/functions.any.ts b/react/features/base/config/functions.any.tsindex 32d7832477..4f1a1be352 100644--- a/react/features/base/config/functions.any.ts+++ b/react/features/base/config/functions.any.ts@@ -7,11 +7,6 @@ import { browser } from '../lib-jitsi-meet';import { getLocalParticipant } from '../participants/functions';import { isEmbedded } from '../util/embedUtils';import { parseURLParams } from '../util/parseURLParams';-import {- appendURLParam,- getNormalizedRoomName,- parseURIString-} from '../util/uri';import { IConfig } from './configType';import CONFIG_WHITELIST from './configWhitelist';@@ -31,6 +26,10 @@ import logger from './logger';// want all functions to be bundled in do_external_connect.export { default as getRoomName } from './getRoomName';+// buildConfigURL lives in its own module so the preload bundle, which runs before the app bundle,+// can compute the exact same config.js URL without pulling in the rest of this feature.+export { buildConfigURL } from './buildConfigURL';+/*** Create a "fake" configuration object for the given base URL. This is used in case the config* couldn't be loaded in the welcome page, so at least we have something to try with.@@ -53,33 +52,6 @@ export function createFakeConfig(baseURL: string) {};}-/**- * Builds the config.js URL for a given location and optional room name.- * Extracted to avoid duplication between app navigation (native) and shard-change reconnect (web).- *- * @param {URL | { href: string }} locationURL - The location URL.- * @param {string | null | undefined} room - Optional room name to append as a query param.- * @returns {string} The full config.js URL with room and release params appended as needed.- */-export function buildConfigURL(locationURL: URL, room?: string | null): string {- const { protocol, host, contextRoot } = parseURIString(locationURL.href);- const normalizedProtocol = protocol === 'http:' || protocol === 'https:' ? protocol : 'https:';- const baseURL = `${normalizedProtocol}//${host}${contextRoot || '/'}`;- let url = `${baseURL}config.js`;-- if (room) {- url = appendURLParam(url, 'room', getNormalizedRoomName(room) ?? '');- }-- const { release } = parseURLParams(locationURL, true, 'search');-- if (release) {- url = appendURLParam(url, 'release', release as string);- }-- return url;-}-/*** Selector used to get the meeting region.*