Merge pull request #1159 from vector-im/SimonBrandner/feat/url

This commit is contained in:
Šimon Brandner 2023-07-05 14:29:01 +02:00 committed by GitHub
commit 5e8cad0fc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

View file

@ -57,7 +57,7 @@
"i18next-http-backend": "^1.4.4", "i18next-http-backend": "^1.4.4",
"livekit-client": "^1.9.7", "livekit-client": "^1.9.7",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#af10b0c44b4a427c8d2224bfd6feb03a12cfd27e", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#426d29d6b9a9d71a3c0d7fe6f7bac3473cd10832",
"matrix-widget-api": "^1.3.1", "matrix-widget-api": "^1.3.1",
"mermaid": "^8.13.8", "mermaid": "^8.13.8",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",

View file

@ -138,6 +138,15 @@ export const ClientProvider: FC<Props> = ({ children }) => {
const { user_id, device_id, access_token, passwordlessUser } = const { user_id, device_id, access_token, passwordlessUser } =
session; session;
const livekit = Config.get().livekit;
const foci = livekit
? [
{
livekitServiceUrl: livekit.livekit_service_url,
},
]
: undefined;
try { try {
return { return {
client: await initClient( client: await initClient(
@ -147,6 +156,7 @@ export const ClientProvider: FC<Props> = ({ children }) => {
userId: user_id, userId: user_id,
deviceId: device_id, deviceId: device_id,
fallbackICEServerAllowed: fallbackICEServerAllowed, fallbackICEServerAllowed: fallbackICEServerAllowed,
foci,
}, },
true true
), ),
@ -163,6 +173,7 @@ export const ClientProvider: FC<Props> = ({ children }) => {
userId: user_id, userId: user_id,
deviceId: device_id, deviceId: device_id,
fallbackICEServerAllowed: fallbackICEServerAllowed, fallbackICEServerAllowed: fallbackICEServerAllowed,
foci,
}, },
false // Don't need the crypto store just to log out false // Don't need the crypto store just to log out
); );

View file

@ -36,7 +36,6 @@ import { UserChoices } from "../livekit/useLiveKit";
import { findDeviceByName } from "../media-utils"; import { findDeviceByName } from "../media-utils";
import { OpenIDLoader } from "../livekit/OpenIDLoader"; import { OpenIDLoader } from "../livekit/OpenIDLoader";
import { ActiveCall } from "./InCallView"; import { ActiveCall } from "./InCallView";
import { Config } from "../config/Config";
declare global { declare global {
interface Window { interface Window {
@ -220,9 +219,15 @@ export function GroupCallView({
undefined undefined
); );
const lkServiceURL = Config.get().livekit?.livekit_service_url; const [livekitServiceURL, setLivekitServiceURL] = useState<
string | undefined
>(groupCall.foci[0]?.livekitServiceUrl);
if (!lkServiceURL) { useEffect(() => {
setLivekitServiceURL(groupCall.foci[0]?.livekitServiceUrl);
}, [setLivekitServiceURL, groupCall]);
if (!livekitServiceURL) {
return <ErrorView error={new Error("No livekit_service_url defined")} />; return <ErrorView error={new Error("No livekit_service_url defined")} />;
} }
@ -232,7 +237,7 @@ export function GroupCallView({
return ( return (
<OpenIDLoader <OpenIDLoader
client={client} client={client}
livekitServiceURL={lkServiceURL} livekitServiceURL={livekitServiceURL}
roomName={matrixInfo.roomName} roomName={matrixInfo.roomName}
> >
<ActiveCall <ActiveCall