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

@ -40,6 +40,7 @@
<% if (t.cost != null) { %><span class="meta"><%= t.cost %> pts</span><% } %>
<% if (t.missing) { %><span class="badge badge-red">not on Twitch anymore</span><% } %>
<% if (t.live === false) { %><span class="badge badge-grey">paused on Twitch</span><% } %>
<% if (t.variations.some(v => v.tts_voice_id)) { %><span class="badge badge-green" title="At least one variation reads the viewer's text aloud">TTS</span><% } %>
<span class="meta">
<%= t.variations.length ? `${on.length}/${t.variations.length} variation${t.variations.length === 1 ? '' : 's'} on` : 'no alert' %>
</span>
@ -72,6 +73,10 @@
<option value="">sticker: headset Streamer</option>
<% for (const st of stickers) { %><option value="<%= st.url %>" <%= v.art === st.url ? 'selected' : '' %>>sticker: <%= st.label %></option><% } %>
</select>
<select name="tts_voice_id" data-tts style="width:auto;" title="Read the viewer's typed text aloud with a voice from the TTS page, shown as a big paper note. The voice replaces the sound. The reward needs 'Require Viewer to Enter Text' on Twitch.">
<option value="">TTS: off</option>
<% for (const tv of ttsVoices) { %><option value="<%= tv.id %>" <%= v.tts_voice_id === tv.id ? 'selected' : '' %>>TTS: <%= tv.name %></option><% } %>
</select>
<button type="button" class="outline btn-sm" data-play title="Play the sound here in the browser">▶</button>
<button type="submit" class="btn-sm">Save</button>
<button type="button" class="outline btn-sm" data-test-var="<%= v.id %>" title="Show it on the overlay">Test</button>
@ -122,6 +127,17 @@
post('/redeems/trigger/test', { kind: b.dataset.kind, key: b.dataset.key });
}));
// TTS on = no sound: grey out the sound picker (the server ignores it too)
document.querySelectorAll('[data-tts]').forEach(sel => {
const form = sel.closest('form'), snd = form.querySelector('[data-sound]');
const sync = () => {
snd.disabled = !!sel.value;
snd.title = sel.value ? 'TTS is on: the voice replaces the sound' : '';
};
sel.addEventListener('change', sync); sync();
form.addEventListener('submit', () => { snd.disabled = false; }); // still submit it, so turning TTS off brings the sound back
});
// two-step delete, no browser dialog
document.querySelectorAll('[data-del]').forEach(b => b.addEventListener('click', () => {
const c = b.parentElement.querySelector('[data-del-confirm]');