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

64
views/settings/obs.ejs Normal file
View file

@ -0,0 +1,64 @@
<h2 class="set-h">OBS sources</h2>
<p class="set-intro">The links are hidden (anyone with one can open your overlay): 👁 shows one, Copy copies it either way. Add them as <strong>Browser Source</strong> in OBS (1920 × 1080, transparent). Pick what one source shows, then copy its link.</p>
<div class="set-card">
<h3>Ready-made links</h3>
<% const links = [
['Everything except chat', '?parts=nochat', 'Alerts, redeems, poll, Hype Train bar, raid send-off.'],
['Chat only', '?parts=chat', 'Set its audio to “Monitor Only (mute output)” so chat sounds stay off stream.'],
['Full-screen videos', '?parts=video', 'Video redeems / Power-ups. 2560 × 1440 source looks sharpest.'],
['Everything in one source', '', 'Simplest, but chat and alert sounds share one fader.'],
]; %>
<% links.forEach(([title, q, hint], i) => { %>
<div class="set-row">
<div class="lbl"><%= title %><small><%= hint %></small></div>
<div class="copy"><code id="obs-<%= i %>" class="secret"><%= overlayUrl + q %></code><button type="button" class="outline eye" data-reveal="#obs-<%= i %>" title="Show">👁</button><button type="button" class="outline" data-copy-from="#obs-<%= i %>">Copy</button></div>
</div>
<% }) %>
</div>
<div class="set-card">
<h3>Build your own</h3>
<div class="set-row">
<div class="lbl">Parts</div>
<div class="set-inline" id="obs-parts">
<% for (const [p, l] of [['alerts', 'Alerts and redeems'], ['chat', 'Chat'], ['poll', 'Poll'], ['hypebar', 'Hype Train bar'], ['raid', 'Raid send-off'], ['video', 'Videos']]) { %>
<label><input type="checkbox" value="<%= p %>" <%= p !== 'video' ? 'checked' : '' %>> <%= l %></label>
<% } %>
</div>
</div>
<div class="set-row">
<div class="lbl">Chat box<small>Optional: left, top, width, height in px of the 1920 × 1080 page. Empty = default place.</small></div>
<div class="set-inline">
<input type="text" id="obs-box" placeholder="130,640,700,360" style="max-width:12rem;">
<label><input type="checkbox" id="obs-up"> newest at the bottom</label>
</div>
</div>
<div class="set-row">
<div class="lbl">Extras</div>
<div class="set-inline"><label title="Needs the HUDFX URL in Settings → Connections"><input type="checkbox" id="obs-hudfx"> HUDFX effects</label></div>
</div>
<div class="set-row">
<div class="lbl">Link</div>
<div class="copy"><code id="obs-built" class="secret"></code><button type="button" class="outline eye" data-reveal="#obs-built" title="Show">👁</button><button type="button" class="outline" data-copy-from="#obs-built">Copy</button></div>
</div>
</div>
<script>
(() => {
const base = <%- JSON.stringify(overlayUrl) %>;
const all = ['alerts', 'chat', 'poll', 'hypebar', 'raid'];
const build = () => {
const picked = [...document.querySelectorAll('#obs-parts input:checked')].map(i => i.value);
const std = picked.filter(p => p !== 'video');
const q = [];
if (!(std.length === all.length && !picked.includes('video'))) q.push('parts=' + picked.join(','));
const box = document.getElementById('obs-box').value.trim();
if (picked.includes('chat') && /^\d+,\d+,\d+,\d+$/.test(box)) q.push('chat=' + box);
if (picked.includes('chat') && document.getElementById('obs-up').checked) q.push('chatflow=up');
if (document.getElementById('obs-hudfx').checked) q.push('ext=hudfx');
document.getElementById('obs-built').textContent = base + (q.length ? '?' + q.join('&') : '');
};
document.querySelectorAll('#obs-parts input, #obs-box, #obs-up, #obs-hudfx').forEach(i => i.addEventListener('input', build));
build();
})();
</script>