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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5 committed 2026-09-11 05:26:33 +00:00
1 parent 4d0954054c
commit 13d3f56c89
4 files changed
+174 -15

No files matched your search

+32
View File
@@ -5660,6 +5660,7 @@ function AppInner() {
const streamViewerRef = useRef<StreamViewer | null>(null);
const [publishState, setPublishState] = useState<PublishState>("idle");
const [publishViewers, setPublishViewers] = useState<number[]>([]);
const [publishPending, setPublishPending] = useState<[number, string][]>([]);
const [publishError, setPublishError] = useState<string | null>(null);
const publisherRef = useRef<StreamPublisher | null>(null);
const publishPreviewRef = useRef<HTMLVideoElement | null>(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() {
</div>
{/* muted: this is our own capture playing back locally */}
<video ref={publishPreviewRef} autoPlay playsInline muted />
{publishPending.map(([clid, message]) => (
<div className="ts-stream-request" key={clid}>
<span className="ts-stream-request-who">
{publishClientName(clid)}
{message && <em>{message}</em>}
</span>
<button
className="ts-stream-request-allow"
onClick={() => void publisherRef.current?.approve(clid)}
>
{t("publish.request.allow")}
</button>
<button onClick={() => publisherRef.current?.deny(clid)}>
{t("publish.request.deny")}
</button>
<button
className="ts-stream-request-block"
onClick={() => publisherRef.current?.deny(clid, true)}
title={t("publish.request.blockHint")}
>
{t("publish.request.block")}
</button>
</div>
))}
{publishError && <div className="ts-stream-panel-error">{publishError}</div>}
</div>
)}