Skip to content

Commit

Permalink
Revert "feat(app): add connection details headers (#335)" (#338)
Browse files Browse the repository at this point in the history
This reverts commit 8e7c8ad.
  • Loading branch information
lukasIO authored Sep 20, 2024
1 parent c24b42e commit bf86c02
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions app/rooms/[roomName]/PageClientImpl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,10 @@ import {
import { useRouter } from 'next/navigation';
import React from 'react';

const DEFAULT_CONN_DETAILS_ENDPOINT = '/api/connection-details';
const CONN_DETAILS_ENDPOINT =
process.env.NEXT_PUBLIC_CONN_DETAILS_ENDPOINT ?? DEFAULT_CONN_DETAILS_ENDPOINT;
process.env.NEXT_PUBLIC_CONN_DETAILS_ENDPOINT ?? '/api/connection-details';
const SHOW_SETTINGS_MENU = process.env.NEXT_PUBLIC_SHOW_SETTINGS_MENU == 'true';

function getConnectionDetailsHeaders(): HeadersInit | undefined {
const hostnameRegex = /^(?<sandbox_id>[a-z0-9][a-z0-9-]*[a-z0-9])(\.sandbox\.livekit\.io|\.sandbox\.staging\.livekit\.io)$/;
const match = window.location.hostname.match(hostnameRegex);
const sandbox_id = match?.groups?.sandbox_id;
if (!sandbox_id) {
return;
}
return { 'X-Sandbox-ID': sandbox_id };
}

export function PageClientImpl(props: {
roomName: string;
region?: string;
Expand Down Expand Up @@ -67,10 +56,7 @@ export function PageClientImpl(props: {
if (props.region) {
url.searchParams.append('region', props.region);
}
const connectionDetailsResp = await fetch(
url.toString(),
{ headers: getConnectionDetailsHeaders() },
);
const connectionDetailsResp = await fetch(url.toString());
const connectionDetailsData = await connectionDetailsResp.json();
setConnectionDetails(connectionDetailsData);
}, []);
Expand Down Expand Up @@ -140,9 +126,9 @@ function VideoConferenceComponent(props: {
dynacast: true,
e2ee: e2eeEnabled
? {
keyProvider,
worker,
}
keyProvider,
worker,
}
: undefined,
};
// @ts-ignore
Expand Down

0 comments on commit bf86c02

Please sign in to comment.