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

@ -138,6 +138,10 @@ function migrate() {
addColumn('settings', 'tts_blocklist', "TEXT DEFAULT ''"); // words/phrases, one per line or comma-separated
addColumn('settings', 'tts_say_name', 'INTEGER DEFAULT 1'); // "<name> says: ..." before the message
addColumn('settings', 'tts_blocklist_seeded', 'INTEGER DEFAULT 0'); // starter list copied in once
addColumn('activity_log', 'replay_json', 'TEXT');
addColumn('settings', 'hudfx_overlay_url', "TEXT DEFAULT ''");
addColumn('settings', 'chat_hidden_users', "TEXT DEFAULT 'bot_account, blerp, blerpbot, hudfx, hudfxbot, lumiastream'"); // never shown in the on-screen chat
addColumn('settings', 'chat_hide_commands', 'INTEGER DEFAULT 1'); // hide messages starting with ! // HUDFX browser source URL, embedded with ?ext=hudfx // the overlay message that was shown (dashboard Replay)
}
// Put the starter TTS blocklist (src/tts-blocklist.txt) into the settings ONCE; after that it is the user's list
@ -205,7 +209,7 @@ function getSettings() {
// what overlay pages get: everything except server-only values (the overlay URL is public)
function getOverlaySettings() {
const { tts_blocklist, tts_blocklist_seeded, ...rest } = getSettings();
const { tts_blocklist, tts_blocklist_seeded, hudfx_overlay_url, ...rest } = getSettings();
return rest;
}
@ -341,11 +345,12 @@ function deleteTtsVoice(id) {
}
// Activity log
function logActivity(eventType, eventDetail, username, data, actionsFired) {
function logActivity(eventType, eventDetail, username, data, actionsFired, replay = null) {
db.prepare(`
INSERT INTO activity_log (event_type, event_detail, username, data_json, actions_fired)
VALUES (@event_type, @event_detail, @username, @data_json, @actions_fired)
INSERT INTO activity_log (event_type, event_detail, username, data_json, actions_fired, replay_json)
VALUES (@event_type, @event_detail, @username, @data_json, @actions_fired, @replay_json)
`).run({
replay_json: replay ? JSON.stringify(replay) : null,
event_type: eventType,
event_detail: eventDetail || null,
username: username || null,
@ -355,7 +360,11 @@ function logActivity(eventType, eventDetail, username, data, actionsFired) {
}
function getActivityLog(limit = 50) {
return db.prepare('SELECT * FROM activity_log ORDER BY created_at DESC LIMIT ?').all(limit);
return db.prepare('SELECT * FROM activity_log ORDER BY created_at DESC, id DESC LIMIT ?').all(limit);
}
function getActivity(id) {
return db.prepare('SELECT * FROM activity_log WHERE id = ?').get(id);
}
module.exports = {
@ -366,5 +375,5 @@ module.exports = {
getAllActions, getAction, createAction, toggleAction, deleteAction, getMatchingActions,
getAllVariations, getVariationsFor, getVariation, createVariation, updateVariation, renameTrigger, deleteVariation,
getAllTtsVoices, getTtsVoice, createTtsVoice, updateTtsVoice, deleteTtsVoice,
logActivity, getActivityLog,
logActivity, getActivityLog, getActivity,
};