Stats per stream and period, public stats page, dashboard settings, Card alert style

Statistics
- Per day and per stream statistics (src/periodstats.js, one generic stat_day table), backfilled
  once from the older tables; Stream / Week / Month / Year / All time views, Community and Streams tabs.
- Viewer count every 5 minutes and title / category history per stream (EventSub channel.update):
  viewer graph, games played (donut), games in the streams list.
- Twitch sync (src/twitchsync.js): followers with follow dates, current subs, mods, VIPs, all-time
  bits, channel emotes, past streams from VODs. Twitch analytics CSV import (src/twitchcsv.js).
- Public stats page on its own host (Settings -> Stats and data): no message text, no bots,
  !hideme / !showme opt-out. Viewer page: roles, follow age, sub status, bits, a menu for rarely used actions.
- StreamElements watch-time importer removed (already imported minutes stay as a baseline).

Dashboard
- Settings and Actions with a left sidebar; each settings page saves only its own fields.
  Connections (Twitch, StreamElements token now set here, HUDFX), OBS links (hidden behind an eye
  toggle) with a link builder, Chat (sound picked from the media library), TTS, Stats and data,
  Backup (export / import the whole setup), Advanced. Time zone setting for the stats pages.
- Actions -> Alerts: alert style, pictures, sounds, bits tiers and card colours, stored in the
  database (src/theme.js); an old file-based theme is imported once. Alert preview page
  (/actions/alerts/preview, tools/preview/export.js for a static copy).
- Old /actions page removed; Actions = Redeems / Alerts / TTS voices / Media.

Alerts
- New plain Card style for everyone (public/alerts/card.js); Polaroid, Cassette and the TTS letter
  stay as optional looks. Redeem variations can be Card, Cassette, Sound only or Video.

Repo
- No channel data in git: the channel's art, stickers and sounds stay on disk (gitignored) and are
  picked in the dashboard; examples for the server config (apache.example.sh, .env.example).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-11-23 11:22:49 +02:00
parent 5bf4bffaa0
commit c481ca92cb
57 changed files with 3080 additions and 774 deletions

62
views/settings/chat.ejs Normal file
View file

@ -0,0 +1,62 @@
<h2 class="set-h">Chat</h2>
<p class="set-intro">The chat shown on the overlay (OBS source with the chat part).</p>
<%- include('_flash') %>
<form method="POST" action="/settings/chat">
<div class="set-card">
<h3>Messages</h3>
<div class="set-row">
<div class="lbl">Message timeout<small>Seconds a message stays. 0 = forever.</small></div>
<input type="number" name="message_timeout" value="<%= settings.message_timeout %>" min="0" max="600" style="max-width:8rem;">
</div>
<div class="set-row">
<div class="lbl">Max messages shown</div>
<input type="number" name="max_messages" value="<%= settings.max_messages %>" min="1" max="100" style="max-width:8rem;">
</div>
<div class="set-row">
<div class="lbl">Hidden chatters<small>Bots and alert services: never shown in the on-screen chat and left out of the statistics. Twitch logins, commas or spaces.</small></div>
<input type="text" name="chat_hidden_users" value="<%= settings.chat_hidden_users || '' %>" placeholder="streamelements, nightbot, …">
</div>
<div class="set-row">
<div class="lbl">Hide ! commands<small>!discord, !lurk … are not shown. Add the bot to Hidden chatters to hide its answer too.</small></div>
<label><input type="checkbox" name="chat_hide_commands" role="switch" <%= settings.chat_hide_commands ? 'checked' : '' %>></label>
</div>
</div>
<div class="set-card">
<h3>Gap sound</h3>
<div class="set-row">
<div class="lbl">Play a sound after silence<small>When a message arrives after chat was quiet for a while.</small></div>
<label><input type="checkbox" name="gap_audio_enabled" role="switch" <%= settings.gap_audio_enabled ? 'checked' : '' %>></label>
</div>
<div class="set-row">
<div class="lbl">Sound<small>From your <a href="/media">Media</a> library (upload new sounds there).</small></div>
<div class="set-inline">
<select name="gap_audio_url" id="gap-sound" style="flex:1; min-width:220px;">
<option value="">— none —</option>
<% for (const m of sounds) { %><option value="<%= m.url %>" <%= m.url === settings.gap_audio_url ? 'selected' : '' %>><%= m.label %></option><% } %>
<% if (settings.gap_audio_url && !sounds.some(m => m.url === settings.gap_audio_url)) { %><option value="<%= settings.gap_audio_url %>" selected>link: <%= settings.gap_audio_url.split('/').pop() %></option><% } %>
</select>
<button type="button" class="outline btn-auto" id="gap-play" title="Play">▶</button>
</div>
<script>
document.getElementById('gap-play').addEventListener('click', () => {
const u = document.getElementById('gap-sound').value;
if (u) { const a = new Audio(u); a.volume = parseFloat(document.querySelector('[name=gap_audio_max_volume]').value) || 1; a.play(); }
});
</script>
</div>
<div class="set-row">
<div class="lbl">Quiet for at least<small>Seconds of silence before the sound plays.</small></div>
<input type="number" name="gap_audio_min_silence" value="<%= settings.gap_audio_min_silence %>" min="0" style="max-width:8rem;">
</div>
<div class="set-row">
<div class="lbl">Volume<small>Quiet right after the minimum silence, louder the longer chat was quiet.</small></div>
<div class="set-inline">
<label>from <input type="number" name="gap_audio_min_volume" value="<%= settings.gap_audio_min_volume %>" min="0" max="1" step="0.05" style="max-width:6rem;"></label>
<label>to <input type="number" name="gap_audio_max_volume" value="<%= settings.gap_audio_max_volume %>" min="0" max="1" step="0.05" style="max-width:6rem;"></label>
<label>full after <input type="number" name="gap_audio_loud_after" value="<%= settings.gap_audio_loud_after %>" min="0" style="max-width:7rem;"> s</label>
</div>
</div>
</div>
<div class="savebar-set"><button type="submit">Save</button></div>
</form>