Pickle Systems
connectionsLogin
Twitch
/Connections/Twitch
connectionsLogin

Admin view

This surface is designed for tenants. Admins can audit connections from Admin pages.
async ({ sess, ctx }) => { const db = ctx?.db; const tid = String(sess?.tenantId || 'default'); const uid = String(sess?.userId || ''); const enabledChannels = (await db.listEnabledChannels('twitch', tid)) || []; const nIdent = uid ? await ctx?.storage?.users?.countProviderIdentities(uid, ['twitch']) : null; const linkedIdentityCount = Number(nIdent?.n || 0); const connected = enabledChannels.length > 0 || linkedIdentityCount > 0; const stateLabel = connected ? 'Connected' : 'Not connected'; const stateHelp = connected ? 'This workspace already has a Twitch identity connected. Use Channel Dashboard to choose which live channels should actually run tools.' : 'Connect a Twitch identity here, then open Channel Dashboard when you want to assign live channels to this workspace.'; return `
Workspace connections

Connect Twitch for this workspace

Use Connections to link the Twitch account this workspace can use. Channel Dashboard stays responsible for channel joins, enablement, and live-tool decisions.
Status
${stateLabel}
${stateHelp}
Linked Twitch identities
${linkedIdentityCount}
Twitch logins connected to this PickleSystems account.
Active workspace channels
${enabledChannels.length}
Twitch channels currently enabled in Channel Dashboard.
Next step

Open Channel Dashboard

Once the Twitch account is linked, use Channel Dashboard to choose where live tools should actually run.
What belongs here

Account linking only

Keep this page focused on linking the Twitch account for the workspace. Channel ownership, joins, and enable or disable decisions stay in Channel Dashboard.
`; }