From 8a28596f4732d2117bcc2ce23d26810050ef089c Mon Sep 17 00:00:00 2001 From: ReaperOfVeriod Date: Sun, 25 Oct 2026 06:21:28 +0100 Subject: [PATCH] Add Guest Star participant controls --- src/App.svelte | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/App.svelte b/src/App.svelte index 769bf10..005a148 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -633,6 +633,40 @@ } } + async function updateCollaborationSlot(action: 'assign' | 'remove', guestId: string, slotId: string) { + if (!collaborationSession || !slotId.trim()) return; + collaborationBusy = true; + collaborationError = ''; + try { + const query = `session_id=${encodeURIComponent(collaborationSession.id)}&guest_id=${encodeURIComponent(guestId)}&slot_id=${encodeURIComponent(slotId.trim())}`; + const response = await fetch(`${serverAddress}/api/v1/twitch/collaboration/slot/${action}?${query}`, { method: action === 'assign' ? 'POST' : 'DELETE', headers: { authorization: `Bearer ${sessionToken}` } }); + if (!response.ok) throw new Error(`Twitch could not ${action} the Guest Star slot.`); + collaborationNotice = action === 'assign' ? 'Guest assigned to slot.' : 'Guest removed from slot.'; + await loadCollaboration(); + } catch (error) { + collaborationError = error instanceof Error ? error.message : 'Guest Star slot update failed.'; + } finally { + collaborationBusy = false; + } + } + + async function updateCollaborationSlotSettings(guestId: string, slotId: string, isLive: boolean) { + if (!collaborationSession || !slotId.trim()) return; + collaborationBusy = true; + collaborationError = ''; + try { + const query = `session_id=${encodeURIComponent(collaborationSession.id)}&guest_id=${encodeURIComponent(guestId)}&slot_id=${encodeURIComponent(slotId.trim())}&is_live=${isLive}`; + const response = await fetch(`${serverAddress}/api/v1/twitch/collaboration/slot/settings?${query}`, { method: 'PATCH', headers: { authorization: `Bearer ${sessionToken}` } }); + if (!response.ok) throw new Error('Twitch could not update the Guest Star slot settings.'); + collaborationNotice = 'Guest Star slot settings updated.'; + await loadCollaboration(); + } catch (error) { + collaborationError = error instanceof Error ? error.message : 'Guest Star slot settings update failed.'; + } finally { + collaborationBusy = false; + } + } + async function markNotificationSeen(notificationId: string) { const response = await fetch(`${serverAddress}/api/v1/admin/notifications/${notificationId}/seen`, { method: 'POST', @@ -1513,6 +1547,7 @@ {#if collaborationNotice}
{collaborationNotice}
{/if}{#if collaborationError}
{collaborationError}
{/if} +
PARTICIPANT CONTROLSTWITCH-AUTHORITATIVE

Assign, remove, or toggle live state for ready participants. Twitch remains authoritative for slot availability.

{#each collaborationSession.guests as guest}
{guest.user_display_name || guest.user_id}{guest.slot_id ? ` SLOT ${guest.slot_id}` : ' UNSLOTTED'}
{#if guest.slot_id}{/if}
{/each}{#if !collaborationSession.guests.length}
No participants are ready for slot controls.
{/if}
{:else}
COLLABORATIONSEARCH OR REVIEW INCOMING