mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
SPA gate should come from EC config not a URL param
This commit is contained in:
@@ -123,6 +123,28 @@ describe("UrlParams", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("enableClientWellKnownLookups", () => {
|
||||||
|
it("is undefined when not set (so the config value applies)", () => {
|
||||||
|
expect(
|
||||||
|
computeUrlParams().enableClientWellKnownLookups,
|
||||||
|
).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("is false when set to false", () => {
|
||||||
|
expect(
|
||||||
|
computeUrlParams("?enableClientWellKnownLookups=false")
|
||||||
|
.enableClientWellKnownLookups,
|
||||||
|
).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("is true when set to true", () => {
|
||||||
|
expect(
|
||||||
|
computeUrlParams("?enableClientWellKnownLookups=true")
|
||||||
|
.enableClientWellKnownLookups,
|
||||||
|
).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("returnToLobby", () => {
|
describe("returnToLobby", () => {
|
||||||
it("is false in SPA mode", () => {
|
it("is false in SPA mode", () => {
|
||||||
expect(computeUrlParams("?returnToLobby=true").returnToLobby).toBe(false);
|
expect(computeUrlParams("?returnToLobby=true").returnToLobby).toBe(false);
|
||||||
|
|||||||
@@ -190,9 +190,10 @@ export interface UrlConfiguration {
|
|||||||
/**
|
/**
|
||||||
* Whether the app may make client `.well-known` lookups against the user's
|
* Whether the app may make client `.well-known` lookups against the user's
|
||||||
* homeserver `server_name` (the post-login well-known poll and the legacy
|
* homeserver `server_name` (the post-login well-known poll and the legacy
|
||||||
* MatrixRTC foci `.well-known` fallback). Defaults to true.
|
* MatrixRTC foci `.well-known` fallback). Set by the embedder in widget mode;
|
||||||
|
* when unset the `enable_client_well_known_lookups` config value applies.
|
||||||
*/
|
*/
|
||||||
enableClientWellKnownLookups: boolean;
|
enableClientWellKnownLookups?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the app should use per participant keys for E2EE.
|
* Whether the app should use per participant keys for E2EE.
|
||||||
@@ -378,7 +379,6 @@ export const computeUrlParams = (search = "", hash = ""): UrlParams => {
|
|||||||
showControls: true,
|
showControls: true,
|
||||||
hideScreensharing: false,
|
hideScreensharing: false,
|
||||||
allowIceFallback: true,
|
allowIceFallback: true,
|
||||||
enableClientWellKnownLookups: true,
|
|
||||||
perParticipantE2EE: true,
|
perParticipantE2EE: true,
|
||||||
controlledAudioDevices: platform === "desktop" ? false : true,
|
controlledAudioDevices: platform === "desktop" ? false : true,
|
||||||
skipLobby: true,
|
skipLobby: true,
|
||||||
@@ -434,7 +434,6 @@ export const computeUrlParams = (search = "", hash = ""): UrlParams => {
|
|||||||
showControls: true,
|
showControls: true,
|
||||||
hideScreensharing: false,
|
hideScreensharing: false,
|
||||||
allowIceFallback: false,
|
allowIceFallback: false,
|
||||||
enableClientWellKnownLookups: true,
|
|
||||||
perParticipantE2EE: false,
|
perParticipantE2EE: false,
|
||||||
controlledAudioDevices: false,
|
controlledAudioDevices: false,
|
||||||
skipLobby: false,
|
skipLobby: false,
|
||||||
|
|||||||
@@ -90,6 +90,19 @@ export class Config {
|
|||||||
return Config.get().default_server_config?.["m.homeserver"].server_name;
|
return Config.get().default_server_config?.["m.homeserver"].server_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the app may make client `.well-known` lookups against the
|
||||||
|
* homeserver `server_name`. The embedded (widget) deployment sets this via
|
||||||
|
* the `enableClientWellKnownLookups` URL parameter; the standalone (SPA)
|
||||||
|
* deployment sets it via `enable_client_well_known_lookups` in config.json.
|
||||||
|
*/
|
||||||
|
public static clientWellKnownLookupsEnabled(): boolean {
|
||||||
|
return (
|
||||||
|
getUrlParams().enableClientWellKnownLookups ??
|
||||||
|
Config.get().enable_client_well_known_lookups
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public config?: ResolvedConfigOptions;
|
public config?: ResolvedConfigOptions;
|
||||||
private initPromise?: Promise<void>;
|
private initPromise?: Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,16 @@ export interface ConfigOptions {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the app may make client `.well-known` lookups against the user's
|
||||||
|
* homeserver `server_name` (the post-login well-known poll and the legacy
|
||||||
|
* MatrixRTC foci `.well-known` fallback). Set to false to keep the app on the
|
||||||
|
* homeserver base URL. This is the standalone (SPA) deployment control;
|
||||||
|
* embedded deployments set it via the `enableClientWellKnownLookups` URL
|
||||||
|
* parameter instead. Defaults to true.
|
||||||
|
*/
|
||||||
|
enable_client_well_known_lookups?: boolean;
|
||||||
|
|
||||||
// Describes the LiveKit configuration to be used.
|
// Describes the LiveKit configuration to be used.
|
||||||
livekit?: {
|
livekit?: {
|
||||||
// The link to the service that returns a livekit url and token to use it.
|
// The link to the service that returns a livekit url and token to use it.
|
||||||
@@ -189,6 +199,7 @@ export interface ResolvedConfigOptions extends ConfigOptions {
|
|||||||
server_name: string;
|
server_name: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
enable_client_well_known_lookups: boolean;
|
||||||
sync_disconnect_grace_period_ms: number;
|
sync_disconnect_grace_period_ms: number;
|
||||||
ssla: string;
|
ssla: string;
|
||||||
matrix_rtc_session: {
|
matrix_rtc_session: {
|
||||||
@@ -211,6 +222,7 @@ export const DEFAULT_CONFIG: ResolvedConfigOptions = {
|
|||||||
features: {
|
features: {
|
||||||
feature_use_device_session_member_events: true,
|
feature_use_device_session_member_events: true,
|
||||||
},
|
},
|
||||||
|
enable_client_well_known_lookups: true,
|
||||||
sync_disconnect_grace_period_ms: 10000,
|
sync_disconnect_grace_period_ms: 10000,
|
||||||
ssla: "https://static.element.io/legal/element-software-and-services-license-agreement-uk-1.pdf",
|
ssla: "https://static.element.io/legal/element-software-and-services-license-agreement-uk-1.pdf",
|
||||||
matrix_rtc_session: {
|
matrix_rtc_session: {
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import {
|
|||||||
} from "../../../livekit/openIDSFU.ts";
|
} from "../../../livekit/openIDSFU.ts";
|
||||||
import { areLivekitTransportsEqual } from "../remoteMembers/MatrixLivekitMembers.ts";
|
import { areLivekitTransportsEqual } from "../remoteMembers/MatrixLivekitMembers.ts";
|
||||||
import { customLivekitUrl } from "../../../settings/settings.ts";
|
import { customLivekitUrl } from "../../../settings/settings.ts";
|
||||||
import { getUrlParams } from "../../../UrlParams.ts";
|
|
||||||
import { RtcTransportAutoDiscovery } from "./RtcTransportAutoDiscovery.ts";
|
import { RtcTransportAutoDiscovery } from "./RtcTransportAutoDiscovery.ts";
|
||||||
|
|
||||||
const logger = rootLogger.getChild("[LocalTransport]");
|
const logger = rootLogger.getChild("[LocalTransport]");
|
||||||
@@ -148,7 +147,7 @@ export const createLocalTransport$ = ({
|
|||||||
const transportDiscovery = new RtcTransportAutoDiscovery({
|
const transportDiscovery = new RtcTransportAutoDiscovery({
|
||||||
client: client,
|
client: client,
|
||||||
resolvedConfig: Config.get(),
|
resolvedConfig: Config.get(),
|
||||||
enableClientWellKnownLookups: getUrlParams().enableClientWellKnownLookups,
|
enableClientWellKnownLookups: Config.clientWellKnownLookupsEnabled(),
|
||||||
wellKnownFetcher: AutoDiscovery.getRawClientConfig.bind(AutoDiscovery),
|
wellKnownFetcher: AutoDiscovery.getRawClientConfig.bind(AutoDiscovery),
|
||||||
logger: logger,
|
logger: logger,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export async function initClient(
|
|||||||
// the values around, but we initialise the matrix client in
|
// the values around, but we initialise the matrix client in
|
||||||
// many different places so we'd have to pass it into all of
|
// many different places so we'd have to pass it into all of
|
||||||
// them.
|
// them.
|
||||||
const { e2eEnabled, enableClientWellKnownLookups } = getUrlParams();
|
const { e2eEnabled } = getUrlParams();
|
||||||
if (!e2eEnabled) {
|
if (!e2eEnabled) {
|
||||||
logger.info("Disabling E2E: group call signalling will NOT be encrypted.");
|
logger.info("Disabling E2E: group call signalling will NOT be encrypted.");
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,9 @@ export async function initClient(
|
|||||||
// Leaving `clientWellKnownPollPeriod` unset stops the SDK polling the
|
// Leaving `clientWellKnownPollPeriod` unset stops the SDK polling the
|
||||||
// homeserver's `server_name` `.well-known` after login.
|
// homeserver's `server_name` `.well-known` after login.
|
||||||
await client.startClient({
|
await client.startClient({
|
||||||
clientWellKnownPollPeriod: enableClientWellKnownLookups ? 60 * 10 : undefined,
|
clientWellKnownPollPeriod: Config.clientWellKnownLookupsEnabled()
|
||||||
|
? 60 * 10
|
||||||
|
: undefined,
|
||||||
});
|
});
|
||||||
await syncPromise;
|
await syncPromise;
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ export const initializeWidget = (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
e2eEnabled,
|
e2eEnabled,
|
||||||
allowIceFallback,
|
allowIceFallback,
|
||||||
enableClientWellKnownLookups,
|
|
||||||
} = getUrlParams();
|
} = getUrlParams();
|
||||||
|
|
||||||
if (!roomId) throw new Error("Room ID must be supplied");
|
if (!roomId) throw new Error("Room ID must be supplied");
|
||||||
@@ -199,7 +198,7 @@ export const initializeWidget = (
|
|||||||
// Leaving `clientWellKnownPollPeriod` unset stops the SDK polling the
|
// Leaving `clientWellKnownPollPeriod` unset stops the SDK polling the
|
||||||
// homeserver's `server_name` `.well-known` after login.
|
// homeserver's `server_name` `.well-known` after login.
|
||||||
await client.startClient({
|
await client.startClient({
|
||||||
clientWellKnownPollPeriod: enableClientWellKnownLookups
|
clientWellKnownPollPeriod: Config.clientWellKnownLookupsEnabled()
|
||||||
? 60 * 10
|
? 60 * 10
|
||||||
: undefined,
|
: undefined,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user