Skip to content

Commit b06af9f

Browse files
Refine extension panel workflows and app surfaces (#56)
* Complete request blocking and blacklist rules * Add interactive extension panel demo * Refine extension workflows and app surfaces - expand Twitch panel request, moderation, demo, and hosted-build flows - preserve playlist ordering across VIP/current transitions and targeted edits - refresh shared app surfaces, homepage messaging, and pagination motion
1 parent c6ec72a commit b06af9f

File tree

71 files changed

+4884
-2287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+4884
-2287
lines changed

docs/twitch-panel-extension-beta-rollout-checklist.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ When you build the Hosted Test artifact, make sure the shell sets the final app
9595
VITE_TWITCH_EXTENSION_API_BASE_URL=https://your-app-host npm run build:extension:panel
9696
```
9797

98+
The build requires `VITE_TWITCH_EXTENSION_API_BASE_URL` or `APP_URL`. If neither is set, it fails instead of falling back to the Twitch asset host.
99+
98100
Upload the contents of:
99101

100102
```text
Lines changed: 24 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,24 @@
1-
# Feature Request: Twitch Panel Extension For Playlist Viewing And Viewer Song Requests
2-
3-
## Scope
4-
5-
RockList.Live includes a Twitch panel extension that gives viewers a Twitch-native request surface on the channel page.
6-
7-
The panel supports:
8-
9-
- read-only playlist viewing without identity sharing
10-
- current queue and now-playing state
11-
- linked viewer request actions:
12-
- add regular request
13-
- add VIP request
14-
- edit current request
15-
- remove own request
16-
- linked viewer summary:
17-
- display name
18-
- VIP token balance for the active channel
19-
- current request count and limit
20-
- requester attribution on playlist items
21-
- owner and moderator playlist actions when the linked viewer has channel access:
22-
- play now
23-
- mark played
24-
- delete item
25-
- switch request kind between regular and VIP when VIP-token management is allowed
26-
27-
## Auth And Access Model
28-
29-
- The panel verifies the Twitch Extension JWT on the server.
30-
- The active Twitch `channel_id` resolves the RockList.Live channel.
31-
- The linked Twitch `user_id` resolves the same app user used by the website.
32-
- Panel write actions require linked identity.
33-
- Panel moderation actions require linked identity plus channel access for the current Twitch channel.
34-
- Moderator access follows the channel's existing moderator capability settings in RockList.Live.
35-
36-
## MVP Experience
37-
38-
### Viewers
39-
40-
- open the panel on Twitch
41-
- view the playlist without leaving Twitch
42-
- share Twitch identity when they want to request songs
43-
- search the catalog
44-
- add, edit, or remove their own request
45-
- spend existing RockList.Live VIP tokens from the panel
46-
47-
### Streamers And Moderators
48-
49-
- open the panel on the live channel page
50-
- view the active queue
51-
- use compact playlist actions directly from the panel when they have access for that channel
52-
- rely on the same queue mutation rules and playlist state used by the main app
53-
54-
## Current Technical Shape
55-
56-
- Extension Backend Service routes live under `src/routes/api/extension`
57-
- linked viewers resolve through `users.twitchUserId`
58-
- playlist moderation uses the shared playlist-management service
59-
- viewer request actions use the shared viewer-request service
60-
61-
## Recommended MVP Acceptance
62-
63-
- A connected channel can install the panel and load playlist state.
64-
- Unlinked viewers can read the playlist.
65-
- Linked viewers can add, edit, and remove their own requests.
66-
- Linked viewers can see their VIP token balance for the current channel.
67-
- Stream owners can manage the playlist from the panel.
68-
- Twitch moderators can manage the playlist from the panel when the channel settings allow it.
69-
- Request behavior matches the website and chat request policy.
70-
- The panel is documented for Local Test, Hosted Test, and self-hosted deployment.
71-
72-
## Notes
73-
74-
- The panel identity-share flow and the website session are separate.
75-
- Opening the website from the panel does not create a website app session by itself.
76-
- Website sign-in still uses the normal Twitch OAuth flow on `rocklist.live`.
1+
# Twitch Panel Extension
2+
3+
RockList.Live includes a Twitch panel extension that keeps playlist viewing and viewer requests on the channel page.
4+
5+
## Viewer surface
6+
7+
- Viewers can read the playlist without identity sharing.
8+
- Linked viewers can search the catalog, add regular requests, add VIP requests, edit the current request, and remove their own request.
9+
- Blocked viewers can still view the playlist and search the catalog. Request actions stay unavailable.
10+
- When the channel blacklist is enabled, blacklisted artists, charters, songs, and versions stay hidden in panel search.
11+
- Channel search filters such as official-only, allowed tunings, and required parts stay active in panel search.
12+
- The panel does not expose a toggle for showing blacklisted results.
13+
14+
## Owner and moderator surface
15+
16+
- Owners can manage the playlist from the panel.
17+
- Moderators can manage the playlist when the channel settings allow those actions.
18+
- Playlist actions use the same management service as the website.
19+
20+
## Shared services
21+
22+
- Viewer request actions use `src/lib/server/viewer-request.ts`.
23+
- Playlist management actions use `src/lib/server/playlist-management.ts`.
24+
- Search uses `src/lib/server/extension-panel.ts`.
Lines changed: 32 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -1,178 +1,32 @@
1-
# Twitch Panel Extension Implementation Plan
2-
3-
## Purpose
4-
5-
The Twitch panel extension acts as a compact RockList.Live client inside Twitch. It lets viewers work with the active channel playlist without using chat commands, and it lets the channel owner or channel moderators perform core playlist actions directly from the panel.
6-
7-
## Current MVP Surface
8-
9-
### Viewer capabilities
10-
11-
- read the playlist without linking identity
12-
- share Twitch identity from the panel
13-
- search the channel-aware catalog
14-
- add a regular request
15-
- add a VIP request when the viewer has a spendable RockList.Live VIP token
16-
- edit the current request
17-
- remove the current request
18-
- view VIP token balance and current request usage for the active channel
19-
20-
### Owner and moderator capabilities
21-
22-
- view the current queue in the panel
23-
- set a queued song as current
24-
- mark the current song as played
25-
- delete a playlist item
26-
- switch a request between regular and VIP when the channel permissions allow VIP-token management
27-
28-
## Channel Access Model
29-
30-
- The panel trusts only the verified Twitch Extension JWT.
31-
- The active `channel_id` resolves the RockList.Live channel.
32-
- The linked `user_id` resolves or creates the matching RockList.Live user by `twitchUserId`.
33-
- The panel resolves access for the current channel as one of:
34-
- `owner`
35-
- `moderator`
36-
- `viewer`
37-
- Moderator access follows the channel's existing moderator capability settings.
38-
39-
## Shared Services
40-
41-
### Viewer request service
42-
43-
Viewer request actions go through the shared viewer-request service.
44-
45-
This keeps the same behavior for:
46-
47-
- request-policy checks
48-
- duplicate checks
49-
- queue-limit checks
50-
- VIP-token spending
51-
- add, edit, and remove behavior
52-
53-
### Playlist management service
54-
55-
Owner and moderator playlist actions go through the shared playlist-management service.
56-
57-
This keeps the same behavior for:
58-
59-
- playlist mutation permissions
60-
- queue mutation calls into the backend worker
61-
- request-kind changes
62-
- audit and actor attribution
63-
64-
## API Surface
65-
66-
### Bootstrap and viewer request routes
67-
68-
- `GET /api/extension/bootstrap`
69-
- `GET /api/extension/search`
70-
- `POST /api/extension/request`
71-
- `POST /api/extension/request/edit`
72-
- `POST /api/extension/request/remove`
73-
74-
### Playlist management route
75-
76-
- `POST /api/extension/playlist`
77-
78-
Supported playlist actions:
79-
80-
- `setCurrent`
81-
- `markPlayed`
82-
- `deleteItem`
83-
- `changeRequestKind`
84-
85-
## Front-End Surface
86-
87-
The panel UI lives in:
88-
89-
- `src/extension/panel/index.html`
90-
- `src/extension/panel/main.tsx`
91-
- `src/extension/panel/app.tsx`
92-
93-
The current panel UI includes:
94-
95-
- compact header with channel title and linked-viewer summary
96-
- playlist and search tabs
97-
- dense queue rows with requester attribution and timestamps
98-
- linked-viewer request highlighting
99-
- transient success and error notices
100-
- loading skeletons during Twitch helper auth and bootstrap
101-
- inline remove confirmation for viewer-owned requests
102-
- compact moderation controls on playlist rows for authorized users
103-
104-
## Twitch Setup
105-
106-
The Twitch extension version should use:
107-
108-
- panel anchor
109-
- request identity link enabled
110-
- URL fetch allowlist for the app origin that serves `/api/extension/*`
111-
112-
Local Test can point at:
113-
114-
- the in-app route: `/extension/panel`
115-
- or the standalone build artifact from `npm run build:extension:panel`
116-
117-
## Hosted Test And Review
118-
119-
The panel is ready for Local Test. Hosted Test and review still require the normal Twitch extension packaging and submission steps:
120-
121-
- upload the built panel artifact
122-
- confirm final allowlists
123-
- confirm reviewer-facing assets and text
124-
- validate the Hosted Test install flow on real test channels
125-
126-
## Recommended MVP Rollout Checklist
127-
128-
Before broader tester rollout, validate these flows with real Twitch accounts:
129-
130-
- viewer, unlinked:
131-
- panel loads
132-
- playlist is readable
133-
- write actions require identity share
134-
- viewer, linked:
135-
- search works
136-
- regular request works
137-
- VIP request works when balance is available
138-
- edit and remove work
139-
- channel owner:
140-
- playlist actions appear
141-
- play now, mark played, delete, and request-kind changes work
142-
- channel moderator:
143-
- playlist actions appear only when the channel settings allow them
144-
- actions use the correct capability gates
145-
146-
## Recommended Next Additions
147-
148-
These items fit well after the first tester rollout, but they are not required for the MVP request loop:
149-
150-
- optional link from the panel to the full playlist page on `rocklist.live`
151-
- read-only blacklist and setlist visibility in the panel
152-
- VIP token management tools in the panel
153-
- blacklist and setlist management tools in the panel
154-
- better cross-surface navigation between Twitch and the website
155-
156-
## Website Auth Note
157-
158-
The panel identity-share flow does not create a website session.
159-
160-
If the panel opens `rocklist.live` in a new window:
161-
162-
- the user is signed in on the website only when the browser already has the RockList.Live session cookie
163-
- otherwise the website still requires the normal Twitch OAuth flow
164-
165-
## Main Files
166-
167-
- `src/lib/server/extension-auth.ts`
168-
- `src/lib/server/extension-panel.ts`
169-
- `src/lib/server/viewer-request.ts`
170-
- `src/lib/server/playlist-management.ts`
171-
- `src/routes/api/extension/bootstrap.ts`
172-
- `src/routes/api/extension/search.ts`
173-
- `src/routes/api/extension/request.ts`
174-
- `src/routes/api/extension/request/edit.ts`
175-
- `src/routes/api/extension/request/remove.ts`
176-
- `src/routes/api/extension/playlist.ts`
177-
- `src/extension/panel/app.tsx`
178-
- `docs/twitch-panel-extension-local-test.md`
1+
# Twitch Panel Extension Architecture
2+
3+
## Auth and channel resolution
4+
5+
- The panel verifies the Twitch Extension JWT on the server.
6+
- `channel_id` resolves the RockList.Live channel.
7+
- Linked `user_id` resolves the matching RockList.Live user profile.
8+
- Access resolves as `owner`, `moderator`, or `viewer` for the active channel.
9+
10+
## API surface
11+
12+
- `GET /api/extension/bootstrap`
13+
- `GET /api/extension/search`
14+
- `POST /api/extension/request`
15+
- `POST /api/extension/request/edit`
16+
- `POST /api/extension/request/remove`
17+
- `POST /api/extension/playlist`
18+
19+
## Shared behavior
20+
21+
- `src/lib/server/extension-panel.ts` shapes bootstrap, live state, search, viewer request calls, and playlist management calls.
22+
- `src/lib/server/viewer-request.ts` enforces blocked-requester rules, request ownership, VIP token rules, and shared request policy checks.
23+
- `src/lib/request-policy.ts` applies blacklist, setlist, queue, and request-limit checks.
24+
- `src/lib/server/playlist-management.ts` enforces owner and moderator playlist permissions.
25+
26+
## Search and request rules
27+
28+
- The panel search applies channel request filters such as official-only, allowed tunings, and required parts.
29+
- The panel hides blacklisted search results when the channel blacklist is enabled.
30+
- The panel keeps playlist viewing available without identity sharing.
31+
- The panel requires linked identity for viewer request writes.
32+
- The panel keeps blocked viewers in a read-only request state.

docs/twitch-panel-extension-local-test.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ Add these values before testing the Twitch panel flow:
1717
- `TWITCH_EXTENSION_SECRET`
1818
- `VITE_TWITCH_EXTENSION_API_BASE_URL`
1919

20-
Notes:
21-
22-
- `TWITCH_EXTENSION_CLIENT_ID` is the Twitch Extension client ID from the Twitch developer console.
23-
- `TWITCH_EXTENSION_SECRET` must be the base64 shared secret from the Twitch Extensions developer console.
24-
- `VITE_TWITCH_EXTENSION_API_BASE_URL` should point at the app origin that serves the `/api/extension/*` endpoints.
25-
- For local development, `VITE_TWITCH_EXTENSION_API_BASE_URL` can be a tunnel URL if Twitch cannot reach `localhost`.
20+
Notes:
21+
22+
- `TWITCH_EXTENSION_CLIENT_ID` is the Twitch Extension client ID from the Twitch developer console.
23+
- `TWITCH_EXTENSION_SECRET` must be the base64 shared secret from the Twitch Extensions developer console.
24+
- `VITE_TWITCH_EXTENSION_API_BASE_URL` points at the app origin that serves the `/api/extension/*` endpoints.
25+
- For local development, `VITE_TWITCH_EXTENSION_API_BASE_URL` can be a tunnel URL if Twitch cannot reach `localhost`.
2626

2727
## Useful commands
2828

@@ -38,7 +38,7 @@ Build the standalone panel artifact:
3838
npm run build:extension:panel
3939
```
4040

41-
For any build that should call a deployed app origin, set the API base URL in the same shell before you build:
41+
For any build that calls a deployed app origin, set the API base URL in the same shell before you build:
4242

4343
```bash
4444
VITE_TWITCH_EXTENSION_API_BASE_URL=https://your-app-host npm run build:extension:panel
@@ -64,13 +64,15 @@ With Twitch Local Test:
6464
1. Run the app locally or expose it through a tunnel.
6565
2. Make sure `APP_URL` and `VITE_TWITCH_EXTENSION_API_BASE_URL` match the origin that Twitch can reach.
6666
3. Point the extension panel view to the app route or the built standalone artifact URL.
67-
4. Open Twitch Local Test and confirm:
68-
- bootstrap succeeds
69-
- unlinked viewers can read the queue
70-
- linked viewers can search and submit requests
71-
- VIP token balance is shown
72-
- edit/remove works for the linked viewer
73-
- channel owners can use playlist actions from the panel
67+
4. Open Twitch Local Test and confirm:
68+
- bootstrap succeeds
69+
- unlinked viewers can read the queue
70+
- linked viewers can search and submit requests
71+
- blocked viewers can read the queue and search, but request actions stay unavailable
72+
- blacklisted search results stay hidden when the channel blacklist is enabled
73+
- VIP token balance is shown
74+
- edit/remove works for the linked viewer
75+
- channel owners can use playlist actions from the panel
7476
- channel moderators can use playlist actions when the channel settings allow them
7577

7678
## Website auth note

0 commit comments

Comments
 (0)