TTS redeems, skip button, per-source chat placement

- Redeem variations can have a TTS voice: the viewer's text is cleaned
  (links out, repeats collapsed, max length, blocked words -> not read),
  spoken as "<name> says: ..." and shown as the big paper note; the
  variation's sound is not played when TTS is on (picker greyed out)
- Settings: TTS max length, say-the-name, blocked words (never sent to
  overlay pages: db.getOverlaySettings)
- Dashboard "Skip current alert" -> /alerts/skip -> overlay skips it
- db.migrate()/addColumn: new columns on existing databases
- Chat: ?chat=left,top,width,height and ?chatflow=up per browser source
  (e.g. the Intermission panel); default unchanged

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-11-21 14:34:41 +02:00
parent b5a81bdb15
commit 4fda6060bf
16 changed files with 228 additions and 28 deletions

View file

@ -2,7 +2,8 @@
Special redeem visuals, called by polaroid.js (shared queue). Each returns a Promise that resolves when done.
FxAlert.giant(d, cur, snd) Gigantify Power-up: the viewer's emote grows huge, pulses while the sound plays
FxAlert.rain(d, cur, snd) On-Screen Celebration Power-up: copies of the emote bounce around the screen
FxAlert.message(d, cur, snd) Highlight my message / Message Effect: big taped paper note with the message
FxAlert.message(d, cur, snd) Highlight my message / Message Effect / TTS redeems: big taped paper note with the message
(d.tts = spoken message URL, d.ttsMs = its length; TTS redeems come without a sound)
d: { name (user), line, msg, emote (image URL or null) }; snd: { url, len, volume }
cur: { anims, timer, audio } so reset/skip can stop it (anything with cancel() can go in anims).
*/
@ -118,7 +119,14 @@
{ delay:550, duration:Math.min(1600, 300 + 18 * text.length), easing:'ease-in-out' });
playSound(cur, snd);
const read = 2000 + 70 * text.length; // time to read it
const exitAt = Math.max(650 + AFTER_ANIM, 650 + read, SOUND_LEAD + snd.len);
let exitAt = Math.max(650 + AFTER_ANIM, 650 + read, SOUND_LEAD + snd.len);
if (d.tts) { // TTS: after the intro sound, keep the note up until it is said
const ttsAt = SOUND_LEAD + (snd.url ? snd.len + 250 : 300);
const a = new Audio(d.tts); a.volume = snd.volume;
const t = setTimeout(() => { cur.audio = a; a.play().catch(err => console.warn('[alerts] TTS blocked:', err.message)); }, ttsAt);
cur.anims.push({ cancel: () => { clearTimeout(t); a.pause(); } }); // skip/reset stop the voice too
exitAt = Math.max(exitAt, ttsAt + (d.ttsMs || 4000) + 900);
}
return done(cur, A(cur, el, [{ transform:'translateY(0)', opacity:1 }, { transform:'translateY(140px) rotate(8deg)', opacity:0 }],
{ delay:exitAt, duration:500, easing:'ease-in' }));
}