Wire it up: Twitch events, dashboard, overlay parts, layout editor removed
Twitch / server - bits via channel.bits.use (cheers + Power-ups, replaces channel.cheer); built-in channel point rewards; polls; Hype Train v2; outgoing raids. New scopes: channel:read:polls, channel:read:hype_train, channel:manage:raids (log in again). - Hype Train: alerts on start / each new level / end, plus the progress bar. - Raid send-off: start/cancel raids from the dashboard (Helix /raids); the card stays until channel.raid reports the raid happened. - StreamElements client started on boot; tip alerts. Dashboard - Twitch + StreamElements status, test buttons (poll, Hype Train bar, raid card), Raid box, activity Reload + auto-refresh, Redeems in the nav. - Two-click delete instead of browser confirm() on Media and Actions. Overlay - ?parts= splits the overlay into OBS sources: chat, alerts, poll, hypebar, raid, or exclusions like ?parts=nochat. Recommended: ?parts=chat (audio Monitor Only, chat sounds stay off stream) + ?parts=nochat. - Now playing switched off (commented, see CLAUDE.md to re-enable). Removed the layout editor and preview page; chat position/style is baked into overlay.ejs from the last saved layout (overlay_layout table kept, unused). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b28e56f991
commit
cdcd3737a7
17 changed files with 589 additions and 140 deletions
132
CLAUDE.md
132
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/<id>/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/<file>`). 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<part>`
|
||||
(`?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=<overlay_id>` 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)
|
||||
|
|
|
|||
134
src/alerts.js
134
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 };
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
92
src/db.js
92
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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<part>, 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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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}`);
|
||||
|
|
|
|||
32
views/_activity.ejs
Normal file
32
views/_activity.ejs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<% if (logs.length === 0) { %>
|
||||
<p><em>No activity yet. Events will appear here once your overlay is connected and Twitch fires events.</em></p>
|
||||
<% } else { %>
|
||||
<figure>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>Event</th>
|
||||
<th>User</th>
|
||||
<th>Detail</th>
|
||||
<th>Actions fired</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for (const log of logs) { %>
|
||||
<tr>
|
||||
<td><small><%= log.created_at %></small></td>
|
||||
<td><code><%= log.event_type %></code></td>
|
||||
<td><%= log.username || '—' %></td>
|
||||
<td><%= log.event_detail || '—' %></td>
|
||||
<td>
|
||||
<span class="badge <%= log.actions_fired > 0 ? 'badge-green' : 'badge-grey' %>">
|
||||
<%= log.actions_fired %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<% } %>
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
<td style="display:flex; gap:0.5rem;">
|
||||
<form method="POST" action="/actions/<%= a.id %>/test"><button type="submit" class="outline" style="padding:0.2rem 0.6rem; font-size:0.8rem;">Test</button></form>
|
||||
<form method="POST" action="/actions/<%= a.id %>/toggle"><button type="submit" class="outline" style="padding:0.2rem 0.6rem; font-size:0.8rem;"><%= a.enabled ? 'Disable' : 'Enable' %></button></form>
|
||||
<form method="POST" action="/actions/<%= a.id %>/delete" onsubmit="return confirm('Delete this action?')"><button type="submit" class="outline" style="padding:0.2rem 0.6rem; font-size:0.8rem; color:#f88;">Delete</button></form>
|
||||
<form method="POST" action="/actions/<%= a.id %>/delete"><button type="button" data-confirm class="outline" style="padding:0.2rem 0.6rem; font-size:0.8rem; color:#f88;">Delete</button></form>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,13 @@
|
|||
<%= settings.channel || '<em>not set</em>' %>
|
||||
</div>
|
||||
<div>
|
||||
<strong>Overlay URL:</strong>
|
||||
<code><%= process.env.APP_BASE_URL %>/overlay/<%= settings.overlay_id %></code>
|
||||
<strong>OBS browser sources</strong> (1920×1080):<br>
|
||||
<small>Chat only, set its audio to <em>Monitor Only (mute output)</em> so chat sounds stay off stream:</small><br>
|
||||
<code><%= process.env.APP_BASE_URL %>/overlay/<%= settings.overlay_id %>?parts=chat</code><br>
|
||||
<small>Everything except chat (alerts, redeems, poll, Hype Train bar, raid send-off):</small><br>
|
||||
<code><%= process.env.APP_BASE_URL %>/overlay/<%= settings.overlay_id %>?parts=nochat</code><br>
|
||||
<small title="parts: chat, alerts, poll, hypebar, raid. List them (?parts=chat,raid) or exclude with no… (?parts=nochat,noraid). No ?parts = everything.">
|
||||
Other combinations: hover for help · everything in one source: <code>/overlay/<%= settings.overlay_id %></code></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -25,6 +30,41 @@
|
|||
<% if (eventsubStatus.lastEventAt) { %><br><small>Last event: <%= eventsubStatus.lastEventAt %></small><% } %>
|
||||
</p>
|
||||
|
||||
<h3>StreamElements tips</h3>
|
||||
<p>
|
||||
<% if (!seStatus.enabled) { %>
|
||||
<span class="badge badge-grey">off</span> <small>set <code>SE_JWT</code> in <code>.env</code> (StreamElements dashboard → avatar → your channel → JWT token) and restart</small>
|
||||
<% } else if (seStatus.subscribed) { %>
|
||||
<span class="badge badge-green">connected</span><% if (seStatus.lastTipAt) { %> <small>last tip: <%= seStatus.lastTipAt %></small><% } %>
|
||||
<% } else { %>
|
||||
<span class="badge badge-grey">connecting…</span>
|
||||
<% } %>
|
||||
<% if (seStatus.error) { %><br><small style="color:#c0392b"><%= seStatus.error %></small><% } %>
|
||||
</p>
|
||||
|
||||
<h3>Raid</h3>
|
||||
<p><small>Start the raid here and the send-off card stays on stream (silent) until the raid happens. Same as Twitch's Raid button.</small></p>
|
||||
<div style="display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; margin-bottom:.4rem;">
|
||||
<input id="raid-target" placeholder="channel name" style="width:16rem; margin:0;">
|
||||
<button type="button" id="raid-start" style="width:auto; margin:0;">Start raid</button>
|
||||
<button type="button" id="raid-cancel" class="outline" style="width:auto; margin:0;">Cancel raid</button>
|
||||
<small id="raid-status"></small>
|
||||
</div>
|
||||
<script>
|
||||
(() => {
|
||||
const out = document.getElementById('raid-status');
|
||||
const call = async (url, body) => {
|
||||
try {
|
||||
const r = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) });
|
||||
const j = await r.json().catch(() => ({}));
|
||||
out.textContent = j.ok ? (j.target ? `Raiding ${j.target}${j.viewers != null ? ' with ' + j.viewers : ''}…` : 'Raid cancelled') : `Failed: ${j.error || r.status}`;
|
||||
} catch (e) { out.textContent = 'Failed: ' + e.message; }
|
||||
};
|
||||
document.getElementById('raid-start').addEventListener('click', () => call('/alerts/raid/start', { target: document.getElementById('raid-target').value }));
|
||||
document.getElementById('raid-cancel').addEventListener('click', () => call('/alerts/raid/cancel'));
|
||||
})();
|
||||
</script>
|
||||
|
||||
<h3>Test alerts</h3>
|
||||
<p><small>Sends a sample alert to the overlay (OBS). Not logged, no actions fired.</small></p>
|
||||
<div id="test-alerts" style="display:flex; flex-wrap:wrap; gap:.4rem; margin-bottom:.5rem;">
|
||||
|
|
@ -43,36 +83,35 @@
|
|||
}));
|
||||
</script>
|
||||
|
||||
<h3>Recent activity</h3>
|
||||
<% if (logs.length === 0) { %>
|
||||
<p><em>No activity yet. Events will appear here once your overlay is connected and Twitch fires events.</em></p>
|
||||
<% } else { %>
|
||||
<figure>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>Event</th>
|
||||
<th>User</th>
|
||||
<th>Detail</th>
|
||||
<th>Actions fired</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for (const log of logs) { %>
|
||||
<tr>
|
||||
<td><small><%= log.created_at %></small></td>
|
||||
<td><code><%= log.event_type %></code></td>
|
||||
<td><%= log.username || '—' %></td>
|
||||
<td><%= log.event_detail || '—' %></td>
|
||||
<td>
|
||||
<span class="badge <%= log.actions_fired > 0 ? 'badge-green' : 'badge-grey' %>">
|
||||
<%= log.actions_fired %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<% } %>
|
||||
<div style="display:flex; align-items:center; gap:1rem; flex-wrap:wrap;">
|
||||
<h3 style="margin:0;">Recent activity</h3>
|
||||
<button type="button" id="activity-reload" class="outline" style="width:auto; padding:.3rem .8rem; margin:0;">Reload</button>
|
||||
<label style="margin:0;"><input type="checkbox" id="activity-auto"> auto-refresh (15 s)</label>
|
||||
<small id="activity-updated"></small>
|
||||
</div>
|
||||
<div id="activity"><%- include('_activity') %></div>
|
||||
<script>
|
||||
(() => {
|
||||
const box = document.getElementById('activity');
|
||||
const stamp = document.getElementById('activity-updated');
|
||||
const auto = document.getElementById('activity-auto');
|
||||
let timer = null;
|
||||
async function reload() {
|
||||
try {
|
||||
const r = await fetch('/activity', { headers: { 'Accept': 'text/html' } });
|
||||
if (r.redirected || !r.ok) { stamp.textContent = 'Reload failed (logged out?)'; return; }
|
||||
box.innerHTML = await r.text();
|
||||
stamp.textContent = 'Updated ' + new Date().toLocaleTimeString();
|
||||
} catch (e) { stamp.textContent = 'Reload failed: ' + e.message; }
|
||||
}
|
||||
function setAuto(on) {
|
||||
clearInterval(timer);
|
||||
if (on) timer = setInterval(reload, 15000);
|
||||
try { localStorage.setItem('activityAuto', on ? '1' : '0'); } catch {}
|
||||
}
|
||||
document.getElementById('activity-reload').addEventListener('click', reload);
|
||||
auto.addEventListener('change', () => setAuto(auto.checked));
|
||||
try { auto.checked = localStorage.getItem('activityAuto') === '1'; } catch {}
|
||||
setAuto(auto.checked);
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@
|
|||
</ul>
|
||||
<ul>
|
||||
<li><a href="/">Dashboard</a></li>
|
||||
<li><a href="/redeems">Redeems</a></li>
|
||||
<li><a href="/actions">Actions</a></li>
|
||||
<li><a href="/media">Media</a></li>
|
||||
<li><a href="/layout">Layout</a></li>
|
||||
<li><a href="/settings">Settings</a></li>
|
||||
<% if (locals.user) { %>
|
||||
<li><a href="/auth/logout">Logout (<%= user.login %>)</a></li>
|
||||
|
|
@ -35,5 +35,16 @@
|
|||
<main class="container">
|
||||
<%- body %>
|
||||
</main>
|
||||
<script>
|
||||
// Two-click delete instead of a browser confirm() dialog: first click arms the button, second submits.
|
||||
document.addEventListener('click', e => {
|
||||
const b = e.target.closest('button[data-confirm]');
|
||||
if (!b) return;
|
||||
if (b.dataset.armed) { b.form.requestSubmit(); return; }
|
||||
b.dataset.armed = '1'; b.dataset.label = b.textContent; b.textContent = 'Really delete?';
|
||||
b.style.fontWeight = '700';
|
||||
setTimeout(() => { delete b.dataset.armed; b.textContent = b.dataset.label; b.style.fontWeight = ''; }, 4000);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
<% } %>
|
||||
</td>
|
||||
<td>
|
||||
<form method="POST" action="/media/<%= f.id %>/delete" onsubmit="return confirm('Delete this file?')">
|
||||
<button type="submit" class="outline" style="padding:0.2rem 0.6rem; font-size:0.8rem; color:#f88;">Delete</button>
|
||||
<form method="POST" action="/media/<%= f.id %>/delete">
|
||||
<button type="button" data-confirm class="outline" style="padding:0.2rem 0.6rem; font-size:0.8rem; color:#f88;">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -3,24 +3,39 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Caveat:wght@700&display=swap">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Caveat:wght@700&family=Nunito:wght@800;900&display=swap">
|
||||
<% const has = p => parts.includes(p); %>
|
||||
<% if (has('alerts')) { %>
|
||||
<link rel="stylesheet" href="/alerts/polaroid.css">
|
||||
<link rel="stylesheet" href="/alerts/cassette.css">
|
||||
<link rel="stylesheet" href="/alerts/fx.css">
|
||||
<% } %>
|
||||
<% if (has('poll')) { %><link rel="stylesheet" href="/alerts/poll.css"><% } %>
|
||||
<% if (has('hypebar')) { %><link rel="stylesheet" href="/alerts/hypebar.css"><% } %>
|
||||
<% if (has('raid')) { %><link rel="stylesheet" href="/alerts/raidcard.css"><% } %>
|
||||
<%# 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:
|
||||
<link rel="stylesheet" href="/alerts/nowplaying.css"> (inside an if (has('nowplaying')))
|
||||
<script src="/alerts/nowplaying.js"></script> (same)
|
||||
the nowplaying line in ws.onmessage below %>
|
||||
<style>
|
||||
/* Chat box and legacy text/video action alerts. Values were taken from the layout editor
|
||||
(removed 2026-11-20); change them here, or override with Custom CSS in Settings. */
|
||||
:root {
|
||||
--chat-left: <%= overlayLayout.chat_left %>%;
|
||||
--chat-top: <%= overlayLayout.chat_top %>%;
|
||||
--chat-width: <%= overlayLayout.chat_width %>%;
|
||||
--chat-height: <%= overlayLayout.chat_height %>%;
|
||||
--chat-font-size: <%= overlayLayout.chat_font_size %>px;
|
||||
--chat-font-family: <%= overlayLayout.chat_font_family %>;
|
||||
--chat-bg-opacity: <%= overlayLayout.chat_bg_opacity %>;
|
||||
--chat-text-color: <%= overlayLayout.chat_text_color %>;
|
||||
--chat-border-radius: <%= overlayLayout.chat_border_radius %>px;
|
||||
--alert-left: <%= overlayLayout.alert_left %>%;
|
||||
--alert-top: <%= overlayLayout.alert_top %>%;
|
||||
--alert-font-size: <%= overlayLayout.alert_font_size %>px;
|
||||
--alert-bg-opacity: <%= overlayLayout.alert_bg_opacity %>;
|
||||
--alert-text-color: <%= overlayLayout.alert_text_color %>;
|
||||
--chat-left: 78%;
|
||||
--chat-top: 75%;
|
||||
--chat-width: 20%;
|
||||
--chat-height: 23%;
|
||||
--chat-font-size: 16px;
|
||||
--chat-font-family: Inter, sans-serif;
|
||||
--chat-bg-opacity: 0.1;
|
||||
--chat-text-color: #ffffff;
|
||||
--chat-border-radius: 10px;
|
||||
--alert-left: 50%;
|
||||
--alert-top: 40%;
|
||||
--alert-font-size: 32px;
|
||||
--alert-bg-opacity: 0.7;
|
||||
--alert-text-color: #ffffff;
|
||||
}
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { background: transparent; overflow: hidden; width: 1920px; height: 1080px; }
|
||||
|
|
@ -83,15 +98,24 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="chat"></div>
|
||||
<div id="alert-box"></div>
|
||||
<video id="alert-video" autoplay></video>
|
||||
<% if (has('chat')) { %><div id="chat"></div><% } %>
|
||||
<% if (has('alerts')) { %><div id="alert-box"></div>
|
||||
<video id="alert-video" autoplay></video><% } %>
|
||||
|
||||
<script src="/vendor/tmi.min.js"></script>
|
||||
<% if (has('alerts')) { %>
|
||||
<script src="/alerts/cassette.js"></script>
|
||||
<script src="/alerts/fx.js"></script>
|
||||
<script src="/alerts/polaroid.js"></script>
|
||||
<% } %>
|
||||
<% if (has('poll')) { %><script src="/alerts/poll.js"></script><% } %>
|
||||
<% if (has('hypebar')) { %><script src="/alerts/hypebar.js"></script><% } %>
|
||||
<% if (has('raid')) { %><script src="/alerts/raidcard.js"></script><% } %>
|
||||
<script>
|
||||
const S = <%- JSON.stringify(settings) %>;
|
||||
const chat = document.getElementById('chat');
|
||||
// which parts this browser source shows (?parts=chat / ?parts=nochat / ?parts=chat,raid / nothing = all)
|
||||
const PARTS = new Set(<%- JSON.stringify(parts) %>);
|
||||
const chat = document.getElementById('chat'); // null when this source has no chat part
|
||||
const alertBox = document.getElementById('alert-box');
|
||||
const alertVideo = document.getElementById('alert-video');
|
||||
|
||||
|
|
@ -112,6 +136,7 @@
|
|||
});
|
||||
|
||||
client.on('message', (channel, tags, message) => {
|
||||
if (!PARTS.has('chat')) return; // other sources only listen to chat for watch streaks
|
||||
const now = Date.now();
|
||||
const silence = (now - lastMsgTime) / 1000;
|
||||
|
||||
|
|
@ -166,10 +191,17 @@
|
|||
Object.assign(S, msg.settings);
|
||||
return;
|
||||
}
|
||||
// every source gets every message; each one only reacts to its own parts (so nothing plays twice)
|
||||
if (msg.type === 'poll') { if (PARTS.has('poll')) PollCard.update(msg.phase, msg.poll); return; }
|
||||
if (msg.type === 'hype_bar') { if (PARTS.has('hypebar')) HypeBar.update(msg.phase, msg.train); return; }
|
||||
// NOWPLAYING: if (msg.type === 'nowplaying') { if (PARTS.has('nowplaying')) NowPlaying.update(msg.np); return; }
|
||||
if (msg.type === 'nowplaying') return;
|
||||
if (msg.type === 'raid_card') { if (PARTS.has('raid')) RaidCard.update(msg.phase, msg.raid); return; }
|
||||
if (!PARTS.has('alerts')) return; // alerts and legacy actions below
|
||||
if (msg.type === 'alert') {
|
||||
// test alerts replace whatever is showing (fast checking); real ones queue
|
||||
if (msg.alert.test === true) PolaroidAlerts.reset();
|
||||
PolaroidAlerts.play(msg.alert);
|
||||
// test buttons: replace other test alerts at once, but never cut off a real alert
|
||||
if (msg.alert.test === true) PolaroidAlerts.playTest(msg.alert);
|
||||
else PolaroidAlerts.play(msg.alert);
|
||||
return;
|
||||
}
|
||||
document.dispatchEvent(new CustomEvent(`heystreamer:${msg.event_type}`, { detail: msg }));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue