diff --git a/CLAUDE.md b/CLAUDE.md index 48e7dfe..56e64d5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -51,18 +51,15 @@ src/ routers/ auth.js — /auth/* (Twitch OAuth) dashboard.js — / (activity log, EventSub status) - overlay.js — /overlay/:uuid, /overlay/:uuid/preview, /ws/overlay + overlay.js — /overlay/:uuid, /ws/overlay actions.js — /actions CRUD media.js — /media upload/delete - layout.js — /layout editor + /layout/positions settings.js — /settings views/ layout.ejs — base shell (nav, Pico CSS) login.ejs dashboard.ejs overlay.ejs — OBS browser source - overlay_preview.ejs - layout_editor.ejs actions.ejs media.ejs settings.ejs @@ -91,7 +88,7 @@ public/ **UUID overlays.** `settings.overlay_id` is a UUID generated on first run. OBS browser source URL is `/overlay/:uuid`. Future multi-user support creates multiple settings rows. -**`layout` is a reserved render variable.** `express-ejs-layouts` uses the `layout` local to pick the wrapper template. Never pass `layout` as a template variable — it will override the layout selection and cause a 500. The DB `overlay_layout` row is passed as `overlayLayout` in all render calls. +**`layout` is a reserved render variable.** `express-ejs-layouts` uses the `layout` local to pick the wrapper template. Never pass `layout` as a template variable — it will override the layout selection and cause a 500. Pass `layout: false` to render without the shell (overlay, `_activity` partial). **Form value parsing.** Never use `parseInt(val) || default` — it overwrites valid `0` values. Use: ```javascript @@ -109,7 +106,6 @@ const flt = (v, d) => { const n = parseFloat(v); return isNaN(n) ? d : n; }; | GET | `/auth/callback` | routers/auth.js | Exchange code, save user, start EventSub | | GET | `/auth/logout` | routers/auth.js | Clear session | | GET | `/overlay/:uuid` | routers/overlay.js | Live OBS browser source | -| GET | `/overlay/:uuid/preview` | routers/overlay.js | Mock preview for layout editor | | WS | `/ws/overlay` | routers/overlay.js | Bidirectional: commands up, actions down | | GET/POST | `/actions` | routers/actions.js | List and create actions | | POST | `/actions/:id/test` | routers/actions.js | Fire immediately, skip cooldown | @@ -117,31 +113,17 @@ const flt = (v, d) => { const n = parseFloat(v); return isNaN(n) ? d : n; }; | DELETE | `/actions/:id` | routers/actions.js | Delete | | GET/POST | `/media` | routers/media.js | Upload, list | | DELETE | `/media/:id` | routers/media.js | Delete file + DB row | -| GET/POST | `/layout` | routers/layout.js | Position + style form (saves all layout fields) | -| POST | `/layout/positions` | routers/layout.js | JSON position update (legacy, kept for future drag) | | GET/POST | `/settings` | routers/settings.js | Channel, gap audio, custom CSS/JS; broadcasts settings_update on save | | POST | `/settings/reconnect` | routers/settings.js | Restart EventSub | +| GET | `/activity` | routers/dashboard.js | Activity table partial (dashboard Reload / auto-refresh) | | POST | `/alerts/test/:key` | routers/alerts.js | Send a sample polaroid alert to the overlay | -## Overlay CSS variable system +## Overlay chat position and style -All overlay positioning and styling uses CSS custom properties rendered into `overlay.ejs` and `overlay_preview.ejs` from the `overlay_layout` row: - -| Variable | Controls | -|---|---| -| `--chat-left`, `--chat-top` | Chat box position (%) | -| `--chat-width`, `--chat-height` | Chat box size (%) | -| `--chat-font-size` | Chat font size (px) | -| `--chat-font-family` | Chat font family | -| `--chat-bg-opacity` | Chat message background opacity | -| `--chat-text-color` | Chat message text colour | -| `--chat-border-radius` | Message border radius (px) | -| `--alert-left`, `--alert-top` | Alert position (%, centered via transform) | -| `--alert-font-size` | Alert font size (px) | -| `--alert-bg-opacity` | Alert background opacity | -| `--alert-text-color` | Alert text colour | - -The layout editor (`/layout`) shows position and style inputs, with a scaled iframe preview of `/overlay/:uuid/preview`. Position inputs update CSS variables in the iframe live on `input` event. All fields (position + style) are saved via `POST /layout`. +The layout editor was removed (2026-11-20). Chat box position/size/font and the legacy text/video action alert +position are fixed CSS custom properties in the `:root` block of `views/overlay.ejs` (values copied from the last +saved layout). Change them there, or override with Custom CSS in Settings. The `overlay_layout` table is still +created but unused, so old data is kept. ## Gap / new-message audio @@ -180,9 +162,10 @@ activity_log — append-only event log | Twitch event | Version | Condition | Scope | Used for | |---|---|---|---|---| | `channel.follow` | 2 | `broadcaster_user_id` + `moderator_user_id` | `moderator:read:followers` | follow alert | -| `channel.cheer` | 1 | `broadcaster_user_id` | `bits:read` | bits alert | +| `channel.bits.use` | 1 | `broadcaster_user_id` | `bits:read` | cheers (bits alert) **and** Power-ups (`type: power_up` → Redeems); replaced `channel.cheer` | | `channel.chat.notification` | 1 | `broadcaster_user_id` + `user_id` | `user:read:chat` | subs, resubs, Prime, multi-month, gifts, community gifts, raids | -| `channel.channel_points_custom_reward_redemption.add` | 1 | `broadcaster_user_id` | `channel:read:redemptions` | actions only (no polaroid yet) | +| `channel.channel_points_custom_reward_redemption.add` | 1 | `broadcaster_user_id` | `channel:read:redemptions` | channel point rewards → Redeems | +| `channel.channel_points_automatic_reward_redemption.add` | 2 | `broadcaster_user_id` | `channel:read:redemptions` | built-in rewards (highlight message, emote unlocks) → Redeems | `channel.chat.notification` replaced `channel.subscribe` / `subscription.message` / `subscription.gift` / `channel.raid`: one event carries `is_prime`, `duration_months` (months bought at once), `cumulative_months`, the gift recipient, @@ -196,6 +179,93 @@ community gift totals and the resub message. `sub_gift` notices with a `communit - Keepalive watchdog: no message for `keepalive_timeout_seconds + 10s` → reconnect. - Status (connected / subscribed / failed / last event) shown on the dashboard. +## Redeems (channel points, built-in rewards, bits Power-ups) + +Page `/redeems` (src/routers/redeems.js, views/redeems.ejs, logic in src/redeems.js), table `reward_variations`. + +- A trigger is `kind` + `key`: `reward` + Twitch reward id, `auto_reward` + built-in type, `power_up` + Power-up type. +- Each trigger has variations (name, rarity, sound, volume, polaroid on/off, caption, art, enabled). On a redemption + ONE enabled variation is picked at random, weighted by rarity (`RARITY` in src/redeems.js: weights Common 50 / Uncommon 25 / Rare 12 / Ultra Rare 3 (Twitch's Super Rare merged into Ultra Rare); chance = weight ÷ sum of the trigger's enabled weights), like + Twitch alert variations. No enabled variation → only logged (and legacy actions run). +- Custom rewards are listed live from Helix `GET /channel_points/custom_rewards` (title, cost, icon); built-in rewards + and Power-ups are fixed lists. Titles are refreshed when a redemption arrives with a new name. +- Shown as a cassette tape (`public/alerts/cassette.js` + `.css`, called from polaroid.js so it shares the queue): + rarity = shell colour (Ultra Rare: gold, glow, foil, sparkles), reels spin over the sound's length, label = + variation name + reward, paper strip = viewer + caption + typed message, sticker in the corner = the variation's + `art` (URL; '' = headset Streamer). `polaroid` column = "show cassette" (0 = sound only). +- Special styles instead of the cassette (`STYLE` in src/redeems.js, drawn by `public/alerts/fx.js` + `.css`): + Gigantify Power-up → the viewer's emote grows giant; On-Screen Celebration → 14 copies of the emote bounce around + the whole screen for the sound's length; Highlight my message and the Message Effect Power-up → big taped paper note, taller than wide (stays ~2 s + 70 ms/char). + Emote image = `https://static-cdn.jtvnw.net/emoticons/v2//default/dark/3.0` from `event.power_up.emote.id` + (fallback: heart). Default caption becomes "gigantified an emote!" / "is celebrating!" / "highlighted:". +- Sound picker = `public/alerts/sounds/redeems/` (redeem clips, loudness-normalized to -16 LUFS with ffmpeg + two-pass loudnorm, so volume stays 0.8), `public/alerts/sounds/` (alert sounds + library) and audio uploaded on + the Media page (`/media/`). Stickers: `public/alerts/stickers/` (cut out with rembg / hand masks). +- polaroid off = sound only: it still waits its turn in the overlay queue and holds it for the sound's length. +- First run: `src/redeems-seed.json` (rebuilt from the Twitch alert setup, 2026-11-20) is loaded when the table is + empty. After that the dashboard is the source of truth; the seed file is never re-applied. +- Test buttons: per variation, and "Test random" per trigger (`POST /redeems/variation/:id/test`, `/redeems/trigger/test`). +- Power-up payload field names (`event.type === 'power_up'`, `event.power_up.type`) follow Twitch's docs but were not + yet seen live; check `activity_log.data_json` of the first real Power-up. + +## Raid send-off and Hype Train bar + +- Outgoing raid send-off: Twitch has no "raid started" event, so raids are started from the dashboard Raid box + (`POST /alerts/raid/start` → Helix `POST /raids`, scope `channel:manage:raids`; `/alerts/raid/cancel` → `DELETE /raids`). + The silent card (`public/alerts/raidcard.js`, top-centre polaroid with the target's Twitch avatar, "raiding X / with N + of you, be nice! ♡", 90 s countdown) stays until `channel.raid` (`from_broadcaster_user_id` = us) arrives, then + shows "raid sent!" and leaves. Raid started on Twitch directly: card shows only at that moment. Test: `raid-card-test`. +- Hype Train bar: every `channel.hype_train.*` event also goes out as `{type:'hype_bar', phase, train}`; + `public/alerts/hypebar.js` shows a slim taped strip top-left (LV, progress/goal bar, time left; gold for Golden + Kappa), outside the queue; on end it shows the final level for 5 s and slides away. Test: dashboard `hype-bar-test`. + +## Overlay parts (two OBS sources) + +`/overlay/:uuid?parts=` picks what a browser source shows: `chat` (chat box + gap audio), `alerts` (polaroid queue, +redeems, legacy actions), `poll`, `hypebar`, `raid`. List parts (`?parts=chat,raid`) or exclude them with `no` +(`?parts=nochat`, `?parts=nochat,noraid`). No `?parts=` = all. Recommended: `?parts=chat` as a source with audio +"Monitor Only (mute output)" (chat sounds stay off stream) and `?parts=nochat` as the main source. Every source receives every WebSocket message and ignores the parts it does not show, so nothing plays twice. +Every source still listens to chat for watch streaks; the server dedupes the reports by message id. + +## Now playing (Feishin) — SWITCHED OFF for now + +Kept in the repo but disabled: the `/nowplaying` route is commented out in `src/app.js`, `nowplaying` is not in +`PARTS` (src/routers/overlay.js) and the overlay lines are commented (marked NOWPLAYING in views/overlay.ejs). +To re-enable: undo those three. Description of how it works when enabled: + + +- `tools/nowplaying/feishin_nowplaying.py` runs on the streaming PC: watches Feishin over MPRIS (D-Bus, PyGObject), + POSTs `{status,title,artist,album,length,cover}` to `/nowplaying` with `Authorization: Bearer NOWPLAYING_KEY` + on every change + every 30 s. Config `~/.config/heystreamer-nowplaying.env` (HEYSTREAMER_URL, NOWPLAYING_KEY); + systemd user unit next to the script. +- Feishin's `mpris:artUrl` points at Navidrome on the LAN and carries the Subsonic token: the helper downloads the + cover itself and sends a 160 px JPEG data URL, so no URL/credential ever leaves the PC. +- Server: `src/routers/nowplaying.js` (key check, sanitised fields, data-URL-only cover) → `src/nowplaying.js` keeps + the current song and broadcasts `{type:'nowplaying', np}`; new overlay connections get it on connect. +- Overlay: `public/alerts/nowplaying.js` small taped paper slip (cover, title, artist) top-right, visible only while + `playing`; hides 1.5 s after pause/stop (grace so track changes do not flicker). Chat position unchanged. + +## StreamElements tips + +- `src/streamelements.js`: Astro websocket (`wss://astro.streamelements.com`, override `SE_URL` for tests). Off unless + `SE_JWT` is set in `.env` (StreamElements dashboard → avatar → channel → JWT token; secret, never commit). +- welcome → subscribe `{topic:'channel.tips', token, token_type:'jwt'}` → `message` on `channel.tips`; tip fields in + `data.donation` (`user.username`, `amount`, `currency`, `message`). Only `approved: 'allowed'` + `status: 'success'` + alert; deduped by `data._id`. `reconnect` message → reconnect with `?reconnect_token=` (no re-subscribe). Server + PINGs every 30 s (ws answers). Status on the dashboard. +- Alert: tip polaroid (sound emotional-damage-meme, heart-eyes Streamer, amount via Intl currency format, badge, +1/2/3 hearts at 10/25/50). + Turn off StreamElements' own tip alert in its overlay to avoid doubles. + +## Polls and Hype Train + +- Polls (`channel.poll.begin/progress/end` v1, scope `channel:read:polls`): `alerts.sendPoll()` broadcasts + `{type:'poll', phase, poll}`; `public/alerts/poll.js` shows a live taped-paper card (left, below the alert corner, + NOT in the alert queue): bars + votes + countdown; on `completed` the winner gets a heart + WINNER stamp, then it + drops away after 9 s (archived/terminated: away after 1.5 s). Begin/end are logged. Test: dashboard `poll-test`. +- Hype Train (`channel.hype_train.*` v2, scope `channel:read:hype_train`): `alerts.fromHypeTrain()` → queued polaroid + alerts on start, on each NEW level (progress fires per contribution) and at the end (top contributors). HYPE Streamer + art; sounds pro-gamer / toad-ya-hoo / tadaaa (in `describe()` case 'hype'). Golden Kappa / Treasure trains named. + ## Polaroid alerts ``` @@ -205,9 +275,10 @@ alerts.send() ─► ws.broadcast({type:'alert', alert}) ─► overlay ─► p └─► dispatch.dispatchEvent() (activity log + legacy actions keep working) ``` -- Alert shape and per-event look (art, caption, tape colour, badge, sound, bits tiers) live in `public/alerts/polaroid.js` (`describe()` + CONFIG block). Art in `public/alerts/art/`, sounds in `public/alerts/sounds/` (lengths in `SOUND_MS`, so the alert holds for the whole sound). +- Alert shape and per-event look (art, caption, tape colour, badge, sound, bits tiers) live in `public/alerts/polaroid.js` (`describe()` + CONFIG block). Art in `public/alerts/art/`, sounds in `public/alerts/sounds/`. Sound lengths come from `SOUND_MS` or are measured in the browser (redeem sounds picked in the UI), so the alert holds for the whole sound. Redeem alerts carry their own sound URL, volume, art and caption. - Watch streaks only exist in chat. The overlay reports them; the server only accepts `chat_notice` from WS connections that pass `?overlay=` and dedupes by message id (several overlays may report the same notice). -- Test buttons on the dashboard: `POST /alerts/test/:key` (keys = `alerts.TEST_KEYS`). Test alerts (`test:true`) replace what is showing; `queue-test` sends four that queue. Not logged, no actions fired. +- Test buttons on the dashboard: `POST /alerts/test/:key` (keys = `alerts.TEST_KEYS`). A test alert (`test:true`, `PolaroidAlerts.playTest`) instantly replaces another *test* alert, but never cuts off or drops a real one: it queues behind it. A real alert arriving during a test cuts the test off. `queue-test` sends four that queue. Not logged, no actions fired. +- Timing: entrance animation ~2.4 s (+0.12 s per stacked photo), then it stays `AFTER_ANIM` (3 s) — or until the sound ends if that is later (sound starts 0.4 s in) — then a 0.65 s exit. ~6 s for most alerts, ~9.3 s for 150+ bits, ~11.1 s for 250+ bits. - Bits under 5: no alert (`BITS_MIN`). ## Production deployment @@ -240,4 +311,3 @@ Twitch requires HTTPS for OAuth redirect URIs in production. Register both in th - Stripe / PayPal / ETH payment notifications - Multiple overlays (multi-user; UUID foundation is in place) - HudFX integration -- Drag-to-reposition in layout editor (removed — CSS transform + interact.js coordinate mismatch; use the position inputs instead) diff --git a/src/alerts.js b/src/alerts.js index 0beee16..ad2b726 100644 --- a/src/alerts.js +++ b/src/alerts.js @@ -20,6 +20,9 @@ function legacy(alert) { case 'gift': return ['gift_sub', alert.tier]; case 'bits': return ['bits', String(alert.bits)]; case 'streak': return ['watch_streak', String(alert.streak)]; + case 'hype': return ['hype_train', alert.phase]; + case 'tip': return ['tip', `${alert.amount} ${alert.currency}`]; + case 'redeem': return [{ reward: 'channel_points', auto_reward: 'auto_reward', power_up: 'power_up' }[alert.kind], alert.key]; default: return [alert.type, null]; } } @@ -44,6 +47,11 @@ function fromCheer(e) { return { type: 'bits', user: e.is_anonymous ? null : (e.user_name || e.user_login), bits: e.bits, message: e.message || null }; } +// channel.bits.use with type 'cheer' (Power-ups are handled by redeems.js) +function fromBitsUse(e) { + return { type: 'bits', user: e.user_name || e.user_login || null, bits: e.bits, message: text(e.message) }; +} + // channel.chat.notification: one event type that carries all sub/gift/raid details // (Prime flag, months bought at once, gift recipient, resub message, community gift totals). function fromChatNotification(e) { @@ -72,6 +80,77 @@ function fromChatNotification(e) { } } +// --- StreamElements tip (Astro channel.tips message data) --- +function fromTip(d) { + const t = d.donation || {}; + return { type: 'tip', user: t.user?.username || 'Someone', amount: Number(t.amount) || 0, currency: t.currency || 'USD', + message: (t.message || '').trim() || null }; +} + +// --- Hype Train (v2): alert on start, on each NEW level, and at the end --- +const hypeLevels = new Map(); // train id -> last announced level +function fromHypeTrain(phase, e) { + const base = { type: 'hype', golden: e.type === 'golden_kappa', treasure: e.type === 'treasure', shared: !!e.is_shared_train, level: e.level }; + if (phase === 'begin') { + hypeLevels.set(e.id, e.level); + return { ...base, phase: 'begin' }; + } + if (phase === 'progress') { + if ((hypeLevels.get(e.id) || 0) >= e.level) return null; // every contribution sends progress: only level-ups alert + hypeLevels.set(e.id, e.level); + return { ...base, phase: 'level' }; + } + hypeLevels.delete(e.id); + const top = (e.top_contributions || []).map(c => c.user_name || c.user_login).filter(Boolean); + return { ...base, phase: 'end', top: [...new Set(top)].slice(0, 3) }; +} + +// --- Hype Train progress bar (persistent while the train runs, outside the queue) --- +function sendHypeBar(phase, e) { + ws.broadcast({ type: 'hype_bar', phase, train: { + id: e.id, level: e.level, progress: e.progress ?? null, goal: e.goal ?? null, total: e.total, + expires_at: e.expires_at || null, golden: e.type === 'golden_kappa', treasure: e.type === 'treasure' } }); +} + +// --- outgoing raid send-off card (persistent, silent, outside the queue) --- +// Twitch has no "raid started" event: the card appears when the raid is started from the dashboard +// (routers/alerts.js -> Helix POST /raids) and stays until channel.raid reports the raid happened. +let pendingRaid = null; // { target, avatar, viewers, started_at } +function raidCard(phase, raid) { ws.broadcast({ type: 'raid_card', phase, raid }); } +function raidStarted(raid) { pendingRaid = { ...raid, started_at: new Date().toISOString() }; raidCard('start', pendingRaid); } +function raidCancelled() { if (pendingRaid) raidCard('cancel', pendingRaid); pendingRaid = null; } +function getPendingRaid() { return pendingRaid; } +// channel.raid from us: the raid happened (started from the dashboard or straight on Twitch) +async function raidHappened(e) { + let raid = pendingRaid; + if (!raid) { // started on Twitch directly: show the card briefly + let avatar = null; + try { + const res = await require('./twitch').helix(`/users?id=${encodeURIComponent(e.to_broadcaster_user_id)}`); + if (res.ok) avatar = (await res.json()).data?.[0]?.profile_image_url || null; + } catch { /* fallback art */ } + raid = { target: e.to_broadcaster_user_name || e.to_broadcaster_user_login, avatar }; + } + raidCard('done', { ...raid, viewers: e.viewers }); + pendingRaid = null; + dispatch.dispatchEvent('raid_out', String(e.viewers), e.to_broadcaster_user_name, e); +} + +// --- polls: a live card on the overlay, outside the alert queue --- +function pollShape(phase, e) { + return { + id: e.id, title: e.title, status: e.status || null, ends_at: e.ends_at || null, + choices: (e.choices || []).map(c => ({ id: c.id, title: c.title, votes: c.votes || 0 })), + }; +} +function sendPoll(phase, e) { + ws.broadcast({ type: 'poll', phase, poll: pollShape(phase, e) }); + if (phase !== 'progress') { + const detail = phase === 'end' ? e.status : null; + dispatch.dispatchEvent(`poll_${phase}`, detail, null, e); // activity log (begin + end only) + } +} + // --- watch streaks, reported by the overlay (they only exist as a chat USERNOTICE) --- const seenNotices = new Map(); // message id -> time; several overlays may report the same notice function fromOverlayNotice(n) { @@ -105,14 +184,63 @@ const SAMPLES = { 'bits-120': { type: 'bits', user: 'LurkingLynx', bits: 120 }, 'bits-200': { type: 'bits', user: 'xX_Lurker_Xx', bits: 200, message: 'RUN' }, 'bits-500': { type: 'bits', user: 'BobTheBuilder99', bits: 500, message: 'Tom da Tank says hi' }, + 'hype-begin':{ type: 'hype', phase: 'begin', level: 1, golden: false }, + 'hype-level':{ type: 'hype', phase: 'level', level: 3, golden: false }, + 'hype-end': { type: 'hype', phase: 'end', level: 4, golden: false, top: ['ChickenWhisperer', 'PixelPotato', 'LurkingLynx'] }, + 'hype-golden':{ type: 'hype', phase: 'begin', level: 1, golden: true }, + 'tip-5': { type: 'tip', user: 'PixelPotato', amount: 5, currency: 'EUR', message: 'for the hydration fund' }, + 'tip-25': { type: 'tip', user: 'ChickenWhisperer', amount: 25, currency: 'EUR', message: 'great stream today, have a coffee on me ♡' }, + 'tip-100': { type: 'tip', user: 'BobTheBuilder99', amount: 100, currency: 'USD', message: null }, }; -const TEST_KEYS = [...Object.keys(SAMPLES), 'queue-test']; +const TEST_KEYS = [...Object.keys(SAMPLES), 'queue-test', 'poll-test', 'hype-bar-test', 'raid-card-test']; + +// fake Hype Train bar: starts at level 1, fills up, levels up twice, ends +let hypeTimers = []; +function testHypeBar() { + hypeTimers.forEach(clearTimeout); hypeTimers = []; + const t = { id: 'test-' + Date.now(), level: 1, progress: 0, goal: 1000, total: 0, type: 'regular' }; + const send = phase => sendHypeBar(phase, { ...t, expires_at: new Date(Date.now() + 300000).toISOString() }); + send('begin'); + for (let i = 1; i <= 12; i++) hypeTimers.push(setTimeout(() => { + t.progress += 300; t.total += 300; + if (t.progress >= t.goal) { t.progress -= t.goal; t.level++; t.goal += 500; } + send('progress'); + }, i * 800)); + hypeTimers.push(setTimeout(() => send('end'), 11000)); +} + +// fake poll: begins, votes come in over ~9 s, then it ends with a winner +let pollTimers = []; +function testPoll() { + pollTimers.forEach(clearTimeout); pollTimers = []; + const ends = new Date(Date.now() + 10000).toISOString(); + const poll = { id: 'test-' + Date.now(), title: 'Which map next?', ends_at: ends, status: null, + choices: [{ id: 'a', title: 'Customs', votes: 0 }, { id: 'b', title: 'Woods', votes: 0 }, { id: 'c', title: 'Reserve', votes: 0 }, { id: 'd', title: 'Factory (chaos)', votes: 0 }] }; + const send = phase => ws.broadcast({ type: 'poll', phase, poll: JSON.parse(JSON.stringify(poll)) }); + send('begin'); + for (let i = 1; i <= 8; i++) pollTimers.push(setTimeout(() => { + poll.choices.forEach((c, k) => { c.votes += Math.floor(Math.random() * (k === 2 ? 6 : 4)); }); + send('progress'); + }, i * 1000)); + pollTimers.push(setTimeout(() => { poll.status = 'completed'; send('end'); }, 10000)); +} + +function sendTestAlert(alert) { + ws.broadcast({ type: 'alert', alert: { ...alert, test: true } }); +} // Test alerts go straight to the overlay; they are not logged and do not fire actions. -// test:true makes the overlay drop what it is showing (fast checking); +// test:true replaces another test alert at once (fast checking) but never cuts off a real alert; // 'queue-test' sends four alerts that queue like real ones. function sendTest(key) { + if (key === 'poll-test') { testPoll(); return true; } + if (key === 'hype-bar-test') { testHypeBar(); return true; } + if (key === 'raid-card-test') { // countdown card, then "raid sent" after 12 s + raidCard('start', { target: 'CozyStreamer', avatar: null, viewers: 42, started_at: new Date().toISOString() }); + setTimeout(() => raidCard('done', { target: 'CozyStreamer', avatar: null, viewers: 42 }), 12000); + return true; + } if (key === 'queue-test') { ws.broadcast({ type: 'alert', alert: { ...SAMPLES['follow'], test: true } }); for (const k of ['bits-60', 'gift-10', 'streak']) ws.broadcast({ type: 'alert', alert: { ...SAMPLES[k], test: 'queue' } }); @@ -124,4 +252,4 @@ function sendTest(key) { return true; } -module.exports = { send, sendTest, SAMPLES, TEST_KEYS, fromFollow, fromCheer, fromChatNotification, fromOverlayNotice }; +module.exports = { send, sendTest, sendTestAlert, sendPoll, sendHypeBar, raidStarted, raidCancelled, raidHappened, getPendingRaid, fromHypeTrain, fromTip, SAMPLES, TEST_KEYS, fromFollow, fromCheer, fromBitsUse, fromChatNotification, fromOverlayNotice }; diff --git a/src/app.js b/src/app.js index e9a8557..0c40d91 100644 --- a/src/app.js +++ b/src/app.js @@ -49,11 +49,13 @@ function requireAuth(req, res, next) { app.use('/auth', require('./routers/auth')); app.use('/overlay', require('./routers/overlay')); +// Now playing (Feishin) is switched off for now; uncomment to bring it back (see views/overlay.ejs). +// app.use('/nowplaying', require('./routers/nowplaying')); // key-protected push from the PC helper app.use('/actions', requireAuth, require('./routers/actions')); app.use('/media', requireAuth, require('./routers/media')); -app.use('/layout', requireAuth, require('./routers/layout')); app.use('/settings', requireAuth, require('./routers/settings')); app.use('/alerts', requireAuth, require('./routers/alerts')); +app.use('/redeems', requireAuth, require('./routers/redeems')); app.use('/', requireAuth, require('./routers/dashboard')); module.exports = app; diff --git a/src/db.js b/src/db.js index ffac595..7c09d81 100644 --- a/src/db.js +++ b/src/db.js @@ -11,7 +11,7 @@ function init() { db.pragma('foreign_keys = ON'); createSchema(); seedSettings(); - seedLayout(); + seedVariations(); console.log(`[db] Initialised — path: ${DB_PATH}`); } @@ -43,6 +43,7 @@ function createSchema() { custom_js TEXT DEFAULT '' ); + -- unused since the layout editor was removed (2026-11-20); kept so old data is not lost CREATE TABLE IF NOT EXISTS overlay_layout ( id INTEGER PRIMARY KEY CHECK(id = 1), chat_left REAL DEFAULT 2.0, @@ -83,6 +84,24 @@ function createSchema() { created_at TEXT DEFAULT (datetime('now')) ); + -- Channel point rewards / built-in rewards / bits Power-ups: each trigger has variations, + -- one is picked at random weighted by rarity (like Twitch alert variations). + CREATE TABLE IF NOT EXISTS reward_variations ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + kind TEXT NOT NULL, -- reward | auto_reward | power_up + key TEXT NOT NULL, -- reward id / built-in reward type / power-up type + title TEXT NOT NULL, -- trigger name shown in the UI (last known) + name TEXT NOT NULL, -- variation name, shown on the polaroid + rarity TEXT NOT NULL DEFAULT 'common', + sound TEXT DEFAULT '', -- URL path under /public, '' = silent + volume REAL DEFAULT 0.8, + polaroid INTEGER DEFAULT 1, -- 0 = sound only + caption TEXT DEFAULT 'redeemed it! ♡', -- text after the viewer's name on the cassette strip + art TEXT DEFAULT '', -- file in /alerts/art, '' = default + enabled INTEGER DEFAULT 1, + created_at TEXT DEFAULT (datetime('now')) + ); + CREATE TABLE IF NOT EXISTS activity_log ( id INTEGER PRIMARY KEY AUTOINCREMENT, event_type TEXT NOT NULL, @@ -104,12 +123,13 @@ function seedSettings() { } } -function seedLayout() { - const row = db.prepare('SELECT id FROM overlay_layout WHERE id = 1').get(); - if (!row) { - db.prepare('INSERT INTO overlay_layout (id) VALUES (1)').run(); - console.log('[db] Created default layout row'); - } +function seedVariations() { + if (db.prepare('SELECT COUNT(*) n FROM reward_variations').get().n > 0) return; + const seed = require('./redeems-seed.json').variations; + const ins = db.prepare(`INSERT INTO reward_variations (kind, key, title, name, rarity, sound, volume, art, enabled) + VALUES (@kind, @key, @title, @name, @rarity, @sound, @volume, @art, @enabled)`); + db.transaction(() => seed.forEach(v => ins.run({ ...v, volume: v.volume ?? 0.8, art: v.art || '', enabled: v.enabled === false ? 0 : 1 })))(); + console.log(`[db] Loaded ${seed.length} default redeem variations`); } // Users @@ -149,26 +169,6 @@ function updateSettings(fields) { db.prepare(`UPDATE settings SET ${cols} WHERE id = 1`).run(fields); } -// Layout -function getLayout() { - return db.prepare('SELECT * FROM overlay_layout WHERE id = 1').get(); -} - -function updateLayout(fields) { - const cols = Object.keys(fields).map(k => `${k} = @${k}`).join(', '); - db.prepare(`UPDATE overlay_layout SET ${cols} WHERE id = 1`).run(fields); -} - -function updateLayoutPositions(fields) { - db.prepare(` - UPDATE overlay_layout SET - chat_left = @chat_left, chat_top = @chat_top, - chat_width = @chat_width, chat_height = @chat_height, - alert_left = @alert_left, alert_top = @alert_top - WHERE id = 1 - `).run(fields); -} - // Media function getAllMedia() { return db.prepare('SELECT * FROM media_files ORDER BY uploaded_at DESC').all(); @@ -232,6 +232,42 @@ function getMatchingActions(eventType, eventDetail) { }); } +// Redeem variations +const VARIATION_FIELDS = ['name', 'rarity', 'sound', 'volume', 'polaroid', 'caption', 'art', 'enabled']; + +function getAllVariations() { + return db.prepare('SELECT * FROM reward_variations ORDER BY kind, title, id').all(); +} + +function getVariationsFor(kind, key) { + return db.prepare('SELECT * FROM reward_variations WHERE kind = ? AND key = ? ORDER BY id').all(kind, key); +} + +function getVariation(id) { + return db.prepare('SELECT * FROM reward_variations WHERE id = ?').get(id); +} + +function createVariation({ kind, key, title, name }) { + const r = db.prepare('INSERT INTO reward_variations (kind, key, title, name) VALUES (?, ?, ?, ?)').run(kind, key, title, name); + return getVariation(r.lastInsertRowid); +} + +function updateVariation(id, fields) { + const f = Object.fromEntries(Object.entries(fields).filter(([k]) => VARIATION_FIELDS.includes(k))); + if (!Object.keys(f).length) return; + const cols = Object.keys(f).map(k => `${k} = @${k}`).join(', '); + db.prepare(`UPDATE reward_variations SET ${cols} WHERE id = @id`).run({ ...f, id }); +} + +// keep the trigger name current when Twitch reports a renamed reward +function renameTrigger(kind, key, title) { + db.prepare('UPDATE reward_variations SET title = ? WHERE kind = ? AND key = ? AND title != ?').run(title, kind, key, title); +} + +function deleteVariation(id) { + db.prepare('DELETE FROM reward_variations WHERE id = ?').run(id); +} + // Activity log function logActivity(eventType, eventDetail, username, data, actionsFired) { db.prepare(` @@ -254,8 +290,8 @@ module.exports = { init, upsertUser, getUserById, getPrimaryUser, updateUserTokens, getSettings, updateSettings, - getLayout, updateLayout, updateLayoutPositions, getAllMedia, getMediaFile, createMedia, deleteMedia, getAllActions, getAction, createAction, toggleAction, deleteAction, getMatchingActions, + getAllVariations, getVariationsFor, getVariation, createVariation, updateVariation, renameTrigger, deleteVariation, logActivity, getActivityLog, }; diff --git a/src/eventsub.js b/src/eventsub.js index a88e95b..77443d6 100644 --- a/src/eventsub.js +++ b/src/eventsub.js @@ -7,7 +7,7 @@ const { WebSocket } = require('ws'); const twitch = require('./twitch'); const alerts = require('./alerts'); -const dispatch = require('./dispatch'); +const redeems = require('./redeems'); const EVENTSUB_URL = 'wss://eventsub.wss.twitch.tv/ws'; @@ -122,10 +122,23 @@ async function subscribeAll(sessionId) { const b = broadcasterId; const subs = [ { type: 'channel.follow', version: '2', condition: { broadcaster_user_id: b, moderator_user_id: b } }, - { type: 'channel.cheer', version: '1', condition: { broadcaster_user_id: b } }, + // cheers AND bits Power-ups (message effect, celebration, gigantify); replaces channel.cheer + { type: 'channel.bits.use', version: '1', condition: { broadcaster_user_id: b } }, // subs, resubs, gifts, community gifts, raids, with Prime/multi-month/recipient/message details { type: 'channel.chat.notification', version: '1', condition: { broadcaster_user_id: b, user_id: b } }, { type: 'channel.channel_points_custom_reward_redemption.add', version: '1', condition: { broadcaster_user_id: b } }, + // built-in rewards: highlight message, unlock emote, ... + { type: 'channel.channel_points_automatic_reward_redemption.add', version: '2', condition: { broadcaster_user_id: b } }, + // live poll card on the overlay + { type: 'channel.poll.begin', version: '1', condition: { broadcaster_user_id: b } }, + { type: 'channel.poll.progress', version: '1', condition: { broadcaster_user_id: b } }, + { type: 'channel.poll.end', version: '1', condition: { broadcaster_user_id: b } }, + // outgoing raid: send-off card (incoming raids come through channel.chat.notification) + { type: 'channel.raid', version: '1', condition: { from_broadcaster_user_id: b } }, + // Hype Train alerts (start, level up, end) + { type: 'channel.hype_train.begin', version: '2', condition: { broadcaster_user_id: b } }, + { type: 'channel.hype_train.progress', version: '2', condition: { broadcaster_user_id: b } }, + { type: 'channel.hype_train.end', version: '2', condition: { broadcaster_user_id: b } }, ]; try { await twitch.validate(); } catch (e) { console.error('[eventsub]', e.message); } @@ -161,8 +174,14 @@ function handleNotification(payload) { case 'channel.follow': alerts.send(alerts.fromFollow(event), event); break; - case 'channel.cheer': - alerts.send(alerts.fromCheer(event), event); + case 'channel.bits.use': + if (event.type === 'power_up' && event.power_up?.type) { + const t = event.power_up.type; + redeems.handle('power_up', t, redeems.POWER_UPS[t] || `Power-up: ${t}`, + { user: event.user_name || event.user_login, input: event.message?.text || null, emote: event.power_up.emote?.id }, event); + } else { + alerts.send(alerts.fromBitsUse(event), event); + } break; case 'channel.chat.notification': { const alert = alerts.fromChatNotification(event); @@ -171,9 +190,32 @@ function handleNotification(payload) { break; } case 'channel.channel_points_custom_reward_redemption.add': - // no polaroid alert yet; existing actions still fire - dispatch.dispatchEvent('channel_points', event.reward?.id, event.user_name || event.user_login, event); + redeems.handle('reward', event.reward.id, event.reward.title, + { user: event.user_name || event.user_login, input: event.user_input || null }, event); break; + case 'channel.poll.begin': + case 'channel.poll.progress': + case 'channel.poll.end': + alerts.sendPoll(type.split('.').pop(), event); + break; + case 'channel.hype_train.begin': + case 'channel.hype_train.progress': + case 'channel.hype_train.end': { + const phase = type.split('.').pop(); + alerts.sendHypeBar(phase, event); // persistent progress bar + const alert = alerts.fromHypeTrain(phase, event); // queued alert on start / new level / end + if (alert) alerts.send(alert, event); + break; + } + case 'channel.raid': + if (event.from_broadcaster_user_id === broadcasterId) alerts.raidHappened(event).catch(e => console.error('[alerts] raid out:', e.message)); + break; + case 'channel.channel_points_automatic_reward_redemption.add': { + const t = event.reward?.type; + redeems.handle('auto_reward', t, redeems.AUTO_REWARDS[t] || t, + { user: event.user_name || event.user_login, input: event.message?.text || null, emote: event.reward?.emote?.id }, event); + break; + } } } diff --git a/src/routers/alerts.js b/src/routers/alerts.js index 203ffdd..2f634e8 100644 --- a/src/routers/alerts.js +++ b/src/routers/alerts.js @@ -1,11 +1,44 @@ const express = require('express'); const router = express.Router(); const alerts = require('../alerts'); +const twitch = require('../twitch'); -// POST /alerts/test/:key — send a sample alert to every connected overlay (dashboard test buttons) +// POST /alerts/test/:key: send a sample alert to every connected overlay (dashboard test buttons) router.post('/test/:key', (req, res) => { const ok = alerts.sendTest(req.params.key); res.status(ok ? 200 : 404).json({ ok }); }); +// POST /alerts/raid/start {target}: start a raid on Twitch and show the send-off card until it happens +router.post('/raid/start', async (req, res) => { + const me = twitch.getUser(); + const login = String(req.body.target || '').trim().replace(/^@/, '').toLowerCase(); + if (!me) return res.status(400).json({ ok: false, error: 'not connected to Twitch' }); + if (!/^[a-z0-9_]{2,25}$/.test(login)) return res.status(400).json({ ok: false, error: 'invalid channel name' }); + try { + const u = await twitch.helix(`/users?login=${encodeURIComponent(login)}`); + const target = u.ok ? (await u.json()).data?.[0] : null; + if (!target) return res.status(404).json({ ok: false, error: 'channel not found' }); + const r = await twitch.helix(`/raids?from_broadcaster_id=${me.twitch_id}&to_broadcaster_id=${target.id}`, { method: 'POST' }); + if (!r.ok) { + const body = await r.json().catch(() => ({})); + return res.status(r.status).json({ ok: false, error: body.message || `Twitch said ${r.status}` }); + } + let viewers = null; + const s = await twitch.helix(`/streams?user_id=${me.twitch_id}`); + if (s.ok) viewers = (await s.json()).data?.[0]?.viewer_count ?? null; + alerts.raidStarted({ target: target.display_name, avatar: target.profile_image_url || null, viewers }); + res.json({ ok: true, target: target.display_name, viewers }); + } catch (e) { res.status(500).json({ ok: false, error: e.message }); } +}); + +// POST /alerts/raid/cancel: cancel the pending raid on Twitch and remove the card +router.post('/raid/cancel', async (req, res) => { + const me = twitch.getUser(); + if (!me) return res.status(400).json({ ok: false, error: 'not connected to Twitch' }); + const r = await twitch.helix(`/raids?broadcaster_id=${me.twitch_id}`, { method: 'DELETE' }).catch(e => ({ ok: false, status: 500, e })); + alerts.raidCancelled(); + res.status(r.ok || r.status === 404 ? 200 : r.status).json({ ok: r.ok || r.status === 404 }); +}); + module.exports = router; diff --git a/src/routers/auth.js b/src/routers/auth.js index 3a5d20f..ab4025b 100644 --- a/src/routers/auth.js +++ b/src/routers/auth.js @@ -12,6 +12,9 @@ const SCOPES = [ 'channel:read:redemptions', 'moderator:read:followers', 'user:read:chat', // channel.chat.notification (sub/gift/raid details) + 'channel:read:polls', // channel.poll.* (poll card on the overlay) + 'channel:read:hype_train', // channel.hype_train.* (Hype Train alerts) + 'channel:manage:raids', // start/cancel raids from the dashboard (send-off card stays during the countdown) ].join(' '); router.get('/login', (req, res) => { diff --git a/src/routers/dashboard.js b/src/routers/dashboard.js index 78cfe6f..7e8304e 100644 --- a/src/routers/dashboard.js +++ b/src/routers/dashboard.js @@ -3,11 +3,17 @@ const router = express.Router(); const db = require('../db'); const eventsub = require('../eventsub'); const alerts = require('../alerts'); +const streamelements = require('../streamelements'); router.get('/', (req, res) => { const logs = db.getActivityLog(50); const settings = db.getSettings(); - res.render('dashboard', { logs, settings, eventsubStatus: eventsub.getStatus(), testKeys: alerts.TEST_KEYS }); + res.render('dashboard', { logs, settings, eventsubStatus: eventsub.getStatus(), seStatus: streamelements.getStatus(), testKeys: alerts.TEST_KEYS }); +}); + +// Activity table only (dashboard Reload button / auto-refresh) +router.get('/activity', (req, res) => { + res.render('_activity', { layout: false, logs: db.getActivityLog(50) }); }); module.exports = router; diff --git a/src/routers/overlay.js b/src/routers/overlay.js index b8078d2..824d653 100644 --- a/src/routers/overlay.js +++ b/src/routers/overlay.js @@ -2,17 +2,26 @@ const express = require('express'); const router = express.Router(); const db = require('../db'); +// Parts of the overlay. One OBS browser source can show all of them, or the overlay can be split into +// several sources with ?parts=, e.g. chat in its own source (audio "Monitor Only" in OBS, so chat +// sounds never reach the stream) and everything else in another. +const PARTS = ['chat', 'alerts', 'poll', 'hypebar', 'raid']; // 'nowplaying' is off for now (see overlay.ejs) +// ?parts=chat,raid only those parts +// ?parts=nochat everything except chat (no, several allowed: nochat,noraid) +// no ?parts / nothing valid: everything +function partsFrom(q) { + if (!q) return PARTS; + const tokens = String(q).split(',').map(s => s.trim().toLowerCase()).filter(Boolean); + const excluded = tokens.filter(t => t.startsWith('no') && PARTS.includes(t.slice(2))).map(t => t.slice(2)); + if (excluded.length) return PARTS.filter(p => !excluded.includes(p)); + const asked = tokens.filter(p => PARTS.includes(p)); + return asked.length ? asked : PARTS; +} + router.get('/:uuid', (req, res) => { const settings = db.getSettings(); if (req.params.uuid !== settings.overlay_id) return res.status(404).send('Overlay not found'); - const overlayLayout = db.getLayout(); - res.render('overlay', { layout: false, settings, overlayLayout }); -}); - -router.get('/:uuid/preview', (req, res) => { - const settings = db.getSettings(); - const overlayLayout = db.getLayout(); - res.render('overlay_preview', { layout: false, settings, overlayLayout }); + res.render('overlay', { layout: false, settings, parts: partsFrom(req.query.parts) }); }); module.exports = router; diff --git a/src/server.js b/src/server.js index b819fc7..c12a1e3 100644 --- a/src/server.js +++ b/src/server.js @@ -29,4 +29,5 @@ server.listen(PORT, () => { } else { console.log('[server] No Twitch login stored yet — log in at /auth/login to start alerts'); } + if (process.env.EVENTSUB_DISABLED !== '1') require('./streamelements').start(); }); diff --git a/src/ws.js b/src/ws.js index 91a9015..3e07f52 100644 --- a/src/ws.js +++ b/src/ws.js @@ -21,6 +21,11 @@ function init(wss) { const trusted = !!overlayId && overlayId === db.getSettings().overlay_id; console.log(`[ws] Client connected${trusted ? ' (overlay)' : ''} — total: ${clients.size}`); if (trusted) ws.on('message', data => handleIncoming(String(data).slice(0, 2000))); + // a freshly loaded overlay gets the current song right away + const np = require('./nowplaying').get(); + if (np) ws.send(JSON.stringify({ type: 'nowplaying', np })); + const raid = require('./alerts').getPendingRaid(); // overlay reloaded during a raid countdown + if (raid) ws.send(JSON.stringify({ type: 'raid_card', phase: 'start', raid })); ws.on('close', () => { clients.delete(ws); console.log(`[ws] Client disconnected — total: ${clients.size}`); diff --git a/views/_activity.ejs b/views/_activity.ejs new file mode 100644 index 0000000..b77aaca --- /dev/null +++ b/views/_activity.ejs @@ -0,0 +1,32 @@ +<% if (logs.length === 0) { %> +

No activity yet. Events will appear here once your overlay is connected and Twitch fires events.

+<% } else { %> +
+ + + + + + + + + + + + <% for (const log of logs) { %> + + + + + + + + <% } %> + +
TimeEventUserDetailActions fired
<%= log.created_at %><%= log.event_type %><%= log.username || '—' %><%= log.event_detail || '—' %> + + <%= log.actions_fired %> + +
+
+<% } %> diff --git a/views/actions.ejs b/views/actions.ejs index 8af7df7..9a39b77 100644 --- a/views/actions.ejs +++ b/views/actions.ejs @@ -78,7 +78,7 @@
-
+
<% } %> diff --git a/views/dashboard.ejs b/views/dashboard.ejs index e6d8464..7e05b53 100644 --- a/views/dashboard.ejs +++ b/views/dashboard.ejs @@ -6,8 +6,13 @@ <%= settings.channel || 'not set' %>
- Overlay URL: - <%= process.env.APP_BASE_URL %>/overlay/<%= settings.overlay_id %> + OBS browser sources (1920×1080):
+ Chat only, set its audio to Monitor Only (mute output) so chat sounds stay off stream:
+ <%= process.env.APP_BASE_URL %>/overlay/<%= settings.overlay_id %>?parts=chat
+ Everything except chat (alerts, redeems, poll, Hype Train bar, raid send-off):
+ <%= process.env.APP_BASE_URL %>/overlay/<%= settings.overlay_id %>?parts=nochat
+ + Other combinations: hover for help · everything in one source: /overlay/<%= settings.overlay_id %>
@@ -25,6 +30,41 @@ <% if (eventsubStatus.lastEventAt) { %>
Last event: <%= eventsubStatus.lastEventAt %><% } %>

+

StreamElements tips

+

+ <% if (!seStatus.enabled) { %> + off set SE_JWT in .env (StreamElements dashboard → avatar → your channel → JWT token) and restart + <% } else if (seStatus.subscribed) { %> + connected<% if (seStatus.lastTipAt) { %> last tip: <%= seStatus.lastTipAt %><% } %> + <% } else { %> + connecting… + <% } %> + <% if (seStatus.error) { %>
<%= seStatus.error %><% } %> +

+ +

Raid

+

Start the raid here and the send-off card stays on stream (silent) until the raid happens. Same as Twitch's Raid button.

+
+ + + + +
+ +

Test alerts

Sends a sample alert to the overlay (OBS). Not logged, no actions fired.

@@ -43,36 +83,35 @@ })); -

Recent activity

-<% if (logs.length === 0) { %> -

No activity yet. Events will appear here once your overlay is connected and Twitch fires events.

-<% } else { %> -
- - - - - - - - - - - - <% for (const log of logs) { %> - - - - - - - - <% } %> - -
TimeEventUserDetailActions fired
<%= log.created_at %><%= log.event_type %><%= log.username || '—' %><%= log.event_detail || '—' %> - - <%= log.actions_fired %> - -
-
-<% } %> +
+

Recent activity

+ + + +
+
<%- include('_activity') %>
+ diff --git a/views/layout.ejs b/views/layout.ejs index 9aadd32..4788dc0 100644 --- a/views/layout.ejs +++ b/views/layout.ejs @@ -23,9 +23,9 @@
  • Dashboard
  • +
  • Redeems
  • Actions
  • Media
  • -
  • Layout
  • Settings
  • <% if (locals.user) { %>
  • Logout (<%= user.login %>)
  • @@ -35,5 +35,16 @@
    <%- body %>
    + diff --git a/views/media.ejs b/views/media.ejs index 0d03b66..40bb214 100644 --- a/views/media.ejs +++ b/views/media.ejs @@ -41,8 +41,8 @@ <% } %> -
    - + +
    diff --git a/views/overlay.ejs b/views/overlay.ejs index db65550..348cf54 100644 --- a/views/overlay.ejs +++ b/views/overlay.ejs @@ -3,24 +3,39 @@ - + + <% const has = p => parts.includes(p); %> + <% if (has('alerts')) { %> + + + <% } %> + <% if (has('poll')) { %><% } %> + <% if (has('hypebar')) { %><% } %> + <% if (has('raid')) { %><% } %> + <%# Now playing (Feishin) is switched off for now. To bring it back: add 'nowplaying' to PARTS in + src/routers/overlay.js, uncomment the /nowplaying route in src/app.js and restore the NOWPLAYING lines here: + (inside an if (has('nowplaying'))) + (same) + the nowplaying line in ws.onmessage below %> -
    -
    - + <% if (has('chat')) { %>
    <% } %> + <% if (has('alerts')) { %>
    + <% } %> + <% if (has('alerts')) { %> + + + <% } %> + <% if (has('poll')) { %><% } %> + <% if (has('hypebar')) { %><% } %> + <% if (has('raid')) { %><% } %>