security: bind TURN grants to screen sessions
This commit is contained in:
+2
-16
@@ -2365,17 +2365,10 @@ async function startRemoteViewer(surface: MediaSurfaceDescriptor): Promise<void>
|
||||
remotePanelStatus(surface.screenId, "connecting");
|
||||
showDetail(`Connecting to ${surface.screenId}…`);
|
||||
try {
|
||||
const [{ createRemoteOfficeMedia }, { fetchEphemeralIceConfiguration }] = await Promise.all([
|
||||
import("./media/remoteMedia.ts"),
|
||||
import("./media/iceClient.ts"),
|
||||
]);
|
||||
const { createRemoteOfficeMedia } = await import("./media/remoteMedia.ts");
|
||||
const optedIn = officeScreenPanel?.state().optedInScreenIds.includes(surface.screenId) ?? false;
|
||||
if (operation !== remoteMediaOperation || access.subject === null || !inside || !office ||
|
||||
office.depth !== "full" || officeId !== surface.officeId || !optedIn) return;
|
||||
const ice = await fetchEphemeralIceConfiguration({ authenticatedFetch: authFetch });
|
||||
if (operation !== remoteMediaOperation || access.subject === null || !inside || !office ||
|
||||
office.depth !== "full" || officeId !== surface.officeId ||
|
||||
!(officeScreenPanel?.state().optedInScreenIds.includes(surface.screenId) ?? false)) return;
|
||||
const video = document.createElement("video");
|
||||
video.muted = true;
|
||||
video.playsInline = true;
|
||||
@@ -2388,7 +2381,6 @@ async function startRemoteViewer(surface: MediaSurfaceDescriptor): Promise<void>
|
||||
role: "viewer",
|
||||
binding: screenBinding(surface),
|
||||
authenticatedFetch: authFetch,
|
||||
peerConnectionConfiguration: ice.configuration,
|
||||
onStateChange: (state) => { if (viewing) syncRemoteViewerState(viewing, state); },
|
||||
onError: (error) => {
|
||||
if (remoteViewedScreen !== viewing) return;
|
||||
@@ -2423,18 +2415,12 @@ async function startRemotePresenter(
|
||||
if (access.subject === null || sharedScreen !== shared || !inside || office?.depth !== "full") return;
|
||||
remotePanelStatus(surface.screenId, "connecting");
|
||||
try {
|
||||
const [{ createRemoteOfficeMedia }, { fetchEphemeralIceConfiguration }] = await Promise.all([
|
||||
import("./media/remoteMedia.ts"),
|
||||
import("./media/iceClient.ts"),
|
||||
]);
|
||||
if (access.subject === null || sharedScreen !== shared || !inside || office?.depth !== "full") return;
|
||||
const ice = await fetchEphemeralIceConfiguration({ authenticatedFetch: authFetch });
|
||||
const { createRemoteOfficeMedia } = await import("./media/remoteMedia.ts");
|
||||
if (access.subject === null || sharedScreen !== shared || !inside || office?.depth !== "full") return;
|
||||
const remote = createRemoteOfficeMedia({
|
||||
role: "presenter",
|
||||
binding: screenBinding(surface),
|
||||
authenticatedFetch: authFetch,
|
||||
peerConnectionConfiguration: ice.configuration,
|
||||
onStateChange(state) {
|
||||
if (sharedScreen !== shared) return;
|
||||
if (state.status === "live") remotePanelStatus(surface.screenId, "live");
|
||||
|
||||
Reference in New Issue
Block a user