From 46f814eced9bd18a7cf438eb47521f04f788049d Mon Sep 17 00:00:00 2001 From: gall-levi-tech Date: Fri, 14 Aug 2026 00:24:55 -0500 Subject: [PATCH] Keep SRT player links local --- services/frame-portal/src/toolLinks.ts | 8 ++++---- services/frame-portal/tests/toolLinks.test.mjs | 16 +++++++++++++++- services/frame-streams/public/app.js | 2 +- services/frame-streams/public/index.html | 2 +- tests/frame-contract.test.mjs | 9 ++++++++- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/services/frame-portal/src/toolLinks.ts b/services/frame-portal/src/toolLinks.ts index 915803d..89c451c 100644 --- a/services/frame-portal/src/toolLinks.ts +++ b/services/frame-portal/src/toolLinks.ts @@ -49,15 +49,15 @@ async function streamLinks( const id = token(stream.id, 3, 128); if (!id) return []; const links: PortalLink[] = []; - if (stream.source_type === "sls" && relayHost && ports) { + if (stream.source_type === "sls" && ports) { const publisher = token(stream.publisher, 3, 128); const player = token(stream.player, 3, 128); const srtla = port(ports.srtla); const sender = port(ports.sender); const receiver = port(ports.player); - if (publisher && srtla) links.push(copyLink("SRTLA publisher", `srtla://${relayHost}:${srtla}?streamid=${publisher}`)); - if (publisher && sender) links.push(copyLink("Direct SRT publisher", `srt://${relayHost}:${sender}?streamid=${publisher}`)); - if (player && receiver) links.push(copyLink("SRT player", `srt://${relayHost}:${receiver}?streamid=${player}`)); + if (publisher && srtla && relayHost) links.push(copyLink("SRTLA publisher", `srtla://${relayHost}:${srtla}?streamid=${publisher}`)); + if (publisher && sender && relayHost) links.push(copyLink("Direct SRT publisher", `srt://${relayHost}:${sender}?streamid=${publisher}`)); + if (player && receiver) links.push(copyLink("SRT player", `srt://localhost:${receiver}?streamid=${player}`)); } const statsUrl = `${statsRoot}/${encodeURIComponent(id)}`; links.push( diff --git a/services/frame-portal/tests/toolLinks.test.mjs b/services/frame-portal/tests/toolLinks.test.mjs index 3acd6cf..51a1b9c 100644 --- a/services/frame-portal/tests/toolLinks.test.mjs +++ b/services/frame-portal/tests/toolLinks.test.mjs @@ -87,7 +87,7 @@ test("collects only sanitized generated links and keeps them on the public dashb assert.deepEqual(groups.streams[0].links, [ { label: "SRTLA publisher", url: "srtla://relay.example.com:5000?streamid=live_main", openable: false }, { label: "Direct SRT publisher", url: "srt://relay.example.com:4001?streamid=live_main", openable: false }, - { label: "SRT player", url: "srt://relay.example.com:4000?streamid=play_main", openable: false }, + { label: "SRT player", url: "srt://localhost:4000?streamid=play_main", openable: false }, { label: "FRAME statistics", url: "/stats/play_main", openable: true }, { label: "BBox Receiver statistics", url: "/stats/play_main?output=bbox_receiver", openable: true }, ]); @@ -107,6 +107,20 @@ test("collects only sanitized generated links and keeps them on the public dashb assert.ok(!serialized.includes("not-exposed")); assert.ok(!serialized.includes("lan-only")); + const streamSettings = payloads.get("streams.test/slsui/api/config"); + payloads.set("streams.test/slsui/api/config", { + ...streamSettings, + relay_host: "", + ports: { ...streamSettings.ports, player: 4100 }, + }); + const localPlayerGroups = await collectToolLinkGroups(config, stack, request); + assert.deepEqual(localPlayerGroups.streams[0].links, [ + { label: "SRT player", url: "srt://localhost:4100?streamid=play_main", openable: false }, + { label: "FRAME statistics", url: "/stats/play_main", openable: true }, + { label: "BBox Receiver statistics", url: "/stats/play_main?output=bbox_receiver", openable: true }, + ]); + payloads.set("streams.test/slsui/api/config", streamSettings); + const belaboxStatus = payloads.get("belabox.test/belabox/api/status"); payloads.set("belabox.test/belabox/api/status", { ...belaboxStatus, remote_belaui: { enabled: false } }); const mixerOnlyGroups = await collectToolLinkGroups(config, stack, request); diff --git a/services/frame-streams/public/app.js b/services/frame-streams/public/app.js index 6d0f5ad..d6a6947 100644 --- a/services/frame-streams/public/app.js +++ b/services/frame-streams/public/app.js @@ -232,7 +232,7 @@ function openLinks(id) { const links = [ ["SRTLA publisher", `srtla://${host}:${ports.srtla}?streamid=${stream.publisher}`], ["Direct SRT publisher", `srt://${host}:${ports.sender}?streamid=${stream.publisher}`], - ["SRT player", `srt://${host}:${ports.player}?streamid=${stream.player}`], + ["SRT player", `srt://localhost:${ports.player}?streamid=${stream.player}`], ["FRAME statistics", statsUrl(stream.id)], ["BBox Receiver statistics", statsUrl(stream.id, "bbox_receiver")], ]; diff --git a/services/frame-streams/public/index.html b/services/frame-streams/public/index.html index 744280e..8ccaf62 100644 --- a/services/frame-streams/public/index.html +++ b/services/frame-streams/public/index.html @@ -126,6 +126,6 @@

Stream Profiles

- + diff --git a/tests/frame-contract.test.mjs b/tests/frame-contract.test.mjs index a6a9c95..ed99646 100644 --- a/tests/frame-contract.test.mjs +++ b/tests/frame-contract.test.mjs @@ -206,7 +206,14 @@ test("Stream Management supports a direct add-stream deep link", async () => { assert.ok(frontend.includes('"#add-stream"'), "SLSUI must recognize /slsui#add-stream"); assert.ok(frontend.includes("clearAddStreamHash"), "SLSUI must clear the add-stream hash after the dialog closes"); assert.ok(html.includes('class="brand brand-link" href="/dashboard"'), "Stream Management logo should return to the LAN dashboard"); - assert.ok(html.includes("app.js?v=stream-delete-dialog-v1"), "SLSUI app cache key should change when management behavior changes"); + assert.ok(html.includes("app.js?v=srt-player-local-v1"), "SLSUI app cache key should change when management behavior changes"); +}); + +test("Stream Management keeps SRT player links local", async () => { + const frontend = await readFile("services/frame-streams/public/app.js", "utf8"); + assert.ok(frontend.includes('["SRT player", `srt://localhost:${ports.player}?streamid=${stream.player}`]')); + assert.ok(frontend.includes('["SRTLA publisher", `srtla://${host}:${ports.srtla}?streamid=${stream.publisher}`]')); + assert.ok(frontend.includes('["Direct SRT publisher", `srt://${host}:${ports.sender}?streamid=${stream.publisher}`]')); }); test("Stream Management deletes streams through a themed unbind dialog", async () => {