Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions services/frame-portal/src/toolLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
16 changes: 15 additions & 1 deletion services/frame-portal/tests/toolLinks.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
]);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion services/frame-streams/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")],
];
Expand Down
2 changes: 1 addition & 1 deletion services/frame-streams/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ <h1>Stream Profiles</h1>
</div>
</dialog>

<script src="/slsui/assets/app.js?v=stream-delete-dialog-v1" defer></script>
<script src="/slsui/assets/app.js?v=srt-player-local-v1" defer></script>
</body>
</html>
9 changes: 8 additions & 1 deletion tests/frame-contract.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Loading