From 13d3f56c89c159f0ae08cf23caef9d0e0fef7b84 Mon Sep 17 00:00:00 2001 From: Moepchi Date: Thu, 10 Sep 2026 20:49:05 +0000 Subject: [PATCH] publish: mirror TS6's pending-join model instead of refusing Live testing against a real TS6 client settled how both settings actually behave, and neither is what the previous commit assumed. The server enforces nothing. It stores accessibility and viewer_limit, echoes them back in notifystreamstarted, and then forwards every join request anyway - a PRIVATE stream at viewer_limit=1 still had both viewers announced to us. Enforcement is entirely the publisher's job. And a refusal is the wrong tool for it. TS6's own rule, from main.js: !autoAccept || full ? pendingJoinRequests.push(...) : joinStreamResponse(...) A request it will not take automatically is left *pending*, not denied. That matters because a denial does not stick - TS6 pairs its own deny with a ban (blockAndDenyJoinRequest) precisely because of this - so a refused client just asks again. Measured: 7 retries in 40 s, with nothing shown to the person waiting. Left pending, the same client asks once and displays "waiting for access" until answered, then connects normally. So: PUBLIC with room to spare admits; anything else queues for the user, including a full stream. Deny is now an explicit choice, and block is the sticky variant. CONTACTS_ONLY behaves as PRIVATE because the contact list is a TS6 account feature we cannot read. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- web/src/App.css | 52 +++++++++++++++++++++++++ web/src/App.tsx | 32 +++++++++++++++ web/src/i18n.tsx | 8 ++++ web/src/publish.ts | 97 +++++++++++++++++++++++++++++++++++++++------- 4 files changed, 174 insertions(+), 15 deletions(-) diff --git a/web/src/App.css b/web/src/App.css index ada726e..e25fd0f 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -4111,3 +4111,55 @@ min-width: 160px; } } + +/* A join request waiting for a decision. TS6 shows the viewer "waiting for + access" the whole time this is on screen, so it should not be subtle. */ +.ts-stream-request { + display: flex; + align-items: center; + gap: 0.4rem; + padding: 0.45rem 0.55rem; + border-top: 1px solid var(--ts-border, #2a2f3a); + background: var(--ts-accent-soft, rgba(90, 140, 255, 0.12)); + font-size: 0.82rem; +} + +.ts-stream-request-who { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.ts-stream-request-who em { + opacity: 0.7; + font-size: 0.75rem; + font-style: normal; +} + +.ts-stream-request button { + flex: none; + padding: 0.2rem 0.5rem; + border: 1px solid var(--ts-border, #2a2f3a); + border-radius: 4px; + background: var(--ts-surface, #1b1f27); + color: inherit; + cursor: pointer; + font-size: 0.78rem; +} + +.ts-stream-request button:hover { + border-color: var(--ts-accent, #5a8cff); +} + +.ts-stream-request-allow { + background: var(--ts-accent, #5a8cff) !important; + color: #fff; +} + +.ts-stream-request-block { + opacity: 0.65; +} diff --git a/web/src/App.tsx b/web/src/App.tsx index de0ed3d..ab231ac 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -5660,6 +5660,7 @@ function AppInner() { const streamViewerRef = useRef(null); const [publishState, setPublishState] = useState("idle"); const [publishViewers, setPublishViewers] = useState([]); + const [publishPending, setPublishPending] = useState<[number, string][]>([]); const [publishError, setPublishError] = useState(null); const publisherRef = useRef(null); const publishPreviewRef = useRef(null); @@ -6624,6 +6625,7 @@ function AppInner() { publisherRef.current = null; setPublishState("idle"); setPublishViewers([]); + setPublishPending([]); removeSession(sessionId, { skipSocketClose: true }); break; } @@ -7931,6 +7933,7 @@ function AppInner() { publisherRef.current = null; setPublishState("idle"); setPublishViewers([]); + setPublishPending([]); }; const handleStreamButton = () => { @@ -7941,6 +7944,9 @@ function AppInner() { setStreamSettingsOpen(true); }; + const publishClientName = (clid: number) => + clients.find((c) => c.id === clid)?.name ?? `#${clid}`; + const handleStartPublishing = (options: StreamPublishOptions) => { if (ownClientId === null) return; setStreamSettingsOpen(false); @@ -7955,9 +7961,11 @@ function AppInner() { if (state === "stopped" || state === "idle") { publisherRef.current = null; setPublishViewers([]); + setPublishPending([]); } }, onViewersChange: setPublishViewers, + onPendingChange: setPublishPending, onError: setPublishError, }); publisherRef.current = publisher; @@ -9636,6 +9644,30 @@ function AppInner() { {/* muted: this is our own capture playing back locally */}