Activity replay, HUDFX in the overlay, chat filter, redeem art fix
- Dashboard Recent activity: readable details (reward name, cost, variation,
rarity, TTS, viewer message; sub tier/months; bits; raids; polls), local
times, and a Replay button. Each row now stores the overlay message that was
shown (activity_log.replay_json); older redeem/raid rows are rebuilt from the
raw Twitch event.
- Fix: redeem alerts lost polaroid/art/emote since 4fda606 (they had ended up
inside a comment), so sticker art, Power-up emotes and sound-only were gone.
- HUDFX embedded in the overlay with ?ext=hudfx (opt-in per OBS source): its
page is served from our domain with the camcorder CSS, its settings API is
forwarded, its Web Worker is started from a same-origin stand-in (the alert
box needs it; blob: workers break the site CSP), and the box sits in the
alert corner. The HUDFX URL is a field on the Settings page.
- Blerp cassette CSS kept with it (src/ext/blerp.css, pasted into the Blerp
OBS source; Blerp itself cannot be embedded: its realtime server only
accepts its own site).
- On-screen chat: Settings -> Hidden chatters and Hide ! commands.
- Outgoing raids are logged with a line in the server log.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5f61b1ebe1
commit
19a0965eb2
16 changed files with 671 additions and 35 deletions
|
|
@ -30,9 +30,10 @@ function legacy(alert) {
|
|||
function send(alert, raw = null) {
|
||||
if (!alert) return;
|
||||
console.log(`[alerts] ${alert.type} — ${alert.user ?? 'anonymous'} ${JSON.stringify({ ...alert, type: undefined, user: undefined })}`);
|
||||
ws.broadcast({ type: 'alert', alert });
|
||||
const msg = { type: 'alert', alert };
|
||||
ws.broadcast(msg);
|
||||
const [eventType, detail] = legacy(alert);
|
||||
dispatch.dispatchEvent(eventType, detail, alert.user, raw || alert);
|
||||
dispatch.dispatchEvent(eventType, detail, alert.user, raw || alert, msg);
|
||||
}
|
||||
|
||||
const text = m => (m && typeof m.text === 'string' && m.text.trim()) ? m.text.trim() : null;
|
||||
|
|
@ -121,19 +122,21 @@ function raidStarted(raid) { pendingRaid = { ...raid, started_at: new Date().toI
|
|||
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 raidTarget(e) {
|
||||
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 */ }
|
||||
return { target: e.to_broadcaster_user_name || e.to_broadcaster_user_login, avatar };
|
||||
}
|
||||
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 });
|
||||
const raid = pendingRaid || await raidTarget(e); // started on Twitch directly: show the card briefly
|
||||
const msg = { type: 'raid_card', phase: 'done', raid: { ...raid, viewers: e.viewers } };
|
||||
ws.broadcast(msg);
|
||||
pendingRaid = null;
|
||||
dispatch.dispatchEvent('raid_out', String(e.viewers), e.to_broadcaster_user_name, e);
|
||||
console.log(`[alerts] raid out — ${msg.raid.target} with ${e.viewers}`);
|
||||
dispatch.dispatchEvent('raid_out', String(e.viewers), e.to_broadcaster_user_name, e, msg);
|
||||
}
|
||||
|
||||
// --- polls: a live card on the overlay, outside the alert queue ---
|
||||
|
|
@ -252,4 +255,4 @@ function sendTest(key) {
|
|||
return true;
|
||||
}
|
||||
|
||||
module.exports = { send, sendTest, sendTestAlert, sendPoll, sendHypeBar, raidStarted, raidCancelled, raidHappened, getPendingRaid, fromHypeTrain, fromTip, SAMPLES, TEST_KEYS, fromFollow, fromCheer, fromBitsUse, fromChatNotification, fromOverlayNotice };
|
||||
module.exports = { raidTarget, send, sendTest, sendTestAlert, sendPoll, sendHypeBar, raidStarted, raidCancelled, raidHappened, getPendingRaid, fromHypeTrain, fromTip, SAMPLES, TEST_KEYS, fromFollow, fromCheer, fromBitsUse, fromChatNotification, fromOverlayNotice };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue