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:
Bashy 2026-11-22 15:29:20 +02:00
parent 5f61b1ebe1
commit 19a0965eb2
16 changed files with 671 additions and 35 deletions

View file

@ -54,11 +54,12 @@ function toAlert(v, { user, input, emote }) {
const style = spoken ? 'tts' : (STYLE[`${v.kind}:${v.key}`] || 'cassette');
const line = spoken ? LINE.tts : LINE[style];
return {
type: 'redeem', kind: v.kind, key: v.key, style,
type: 'redeem', kind: v.kind, key: v.key, style, vid: v.id, // vid: re-speak on replay if the mp3 was pruned
user, reward: v.title, variation: v.name, rarity: v.rarity, input: input || null,
// special styles have their own wording unless the caption was customised
caption: style !== 'cassette' && v.caption === 'redeemed it! ♡' ? line : v.caption,
sound: spoken ? null : (v.sound || null), volume: v.volume, // TTS on: the voice replaces the sound polaroid: !!v.polaroid, art: v.art || null, emote: emoteUrl(emote),
sound: spoken ? null : (v.sound || null), volume: v.volume, // TTS on: the voice replaces the sound
polaroid: !!v.polaroid, art: v.art || null, emote: emoteUrl(emote),
};
}
@ -106,6 +107,24 @@ function handle(kind, key, title, { user, input, emote }, raw) {
return alert;
}
// Dashboard Replay of an old activity row that has no stored alert: a fresh pick for the trigger,
// with the viewer's original name and text. Resolves to the alert, or null if nothing is configured.
async function rebuild(kind, key, { user, input, emote }) {
const v = pick(db.getVariationsFor(kind, key));
if (!v) return null;
const alert = toAlert(v, { user, input, emote });
if (v.tts_voice_id && input) await addSpeech(v, alert);
return alert;
}
// Replay of a stored TTS alert whose mp3 was pruned: speak it again with the same variation's voice.
async function respeak(alert) {
const v = alert.vid && db.getVariation(alert.vid);
for (const k of ['tts', 'tts_ms', 'tts_env', 'tts_prefix']) delete alert[k];
if (v && v.tts_voice_id && alert.input) await addSpeech(v, alert);
return alert;
}
// Dashboard test: one specific variation, or a random pick for the whole trigger.
function test({ id, kind, key }) {
const v = id ? db.getVariation(id) : pick(db.getVariationsFor(kind, key));
@ -119,4 +138,4 @@ function test({ id, kind, key }) {
return true;
}
module.exports = { RARITY, AUTO_REWARDS, POWER_UPS, STYLE, pick, handle, test };
module.exports = { RARITY, AUTO_REWARDS, POWER_UPS, STYLE, pick, handle, test, rebuild, respeak };