heystreamer/views/actions.ejs
Bashy cdcd3737a7 Wire it up: Twitch events, dashboard, overlay parts, layout editor removed
Twitch / server
- bits via channel.bits.use (cheers + Power-ups, replaces channel.cheer); built-in
  channel point rewards; polls; Hype Train v2; outgoing raids. New scopes:
  channel:read:polls, channel:read:hype_train, channel:manage:raids (log in again).
- Hype Train: alerts on start / each new level / end, plus the progress bar.
- Raid send-off: start/cancel raids from the dashboard (Helix /raids); the card
  stays until channel.raid reports the raid happened.
- StreamElements client started on boot; tip alerts.

Dashboard
- Twitch + StreamElements status, test buttons (poll, Hype Train bar, raid card),
  Raid box, activity Reload + auto-refresh, Redeems in the nav.
- Two-click delete instead of browser confirm() on Media and Actions.

Overlay
- ?parts= splits the overlay into OBS sources: chat, alerts, poll, hypebar, raid,
  or exclusions like ?parts=nochat. Recommended: ?parts=chat (audio Monitor Only,
  chat sounds stay off stream) + ?parts=nochat.
- Now playing switched off (commented, see CLAUDE.md to re-enable).

Removed the layout editor and preview page; chat position/style is baked into
overlay.ejs from the last saved layout (overlay_layout table kept, unused).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 23:18:15 +02:00

88 lines
3.4 KiB
Text

<h2>Actions</h2>
<p><small>Map Twitch events to sounds, videos, or on-screen alerts.</small></p>
<details>
<summary>Add new action</summary>
<form method="POST" action="/actions" style="margin-top:1rem;">
<div style="display:grid; grid-template-columns:1fr 1fr; gap:1rem;">
<label>Name <input type="text" name="name" required placeholder="e.g. Sub sound"></label>
<label>
Event type
<select name="event_type" required>
<option value="sub">Sub</option>
<option value="gift_sub">Gift sub</option>
<option value="bits">Bits</option>
<option value="channel_points">Channel points</option>
<option value="command">Chat command</option>
<option value="follow">Follow</option>
<option value="raid">Raid</option>
</select>
</label>
<label>
Event detail <small>(tier / min bits / command name / reward ID)</small>
<input type="text" name="event_detail" placeholder="Optional">
</label>
<label>
Action type
<select name="action_type" required>
<option value="sound">Sound</option>
<option value="video">Video</option>
<option value="alert">Alert text</option>
</select>
</label>
<label>
Media file
<select name="media_file_id">
<option value="">— none —</option>
<% for (const f of media) { %>
<option value="<%= f.id %>"><%= f.original_name %> (<%= f.media_type %>)</option>
<% } %>
</select>
</label>
<label>Alert text <input type="text" name="alert_text" placeholder="{username} just subbed!"></label>
<label>Cooldown (seconds) <input type="number" name="cooldown_seconds" value="0" min="0"></label>
</div>
<button type="submit">Add action</button>
</form>
</details>
<% if (actions.length === 0) { %>
<p><em>No actions yet.</em></p>
<% } else { %>
<figure>
<table>
<thead>
<tr>
<th>Name</th>
<th>Event</th>
<th>Detail</th>
<th>Action</th>
<th>Cooldown</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
<% for (const a of actions) { %>
<tr>
<td><%= a.name %></td>
<td><code><%= a.event_type %></code></td>
<td><%= a.event_detail || '—' %></td>
<td><code><%= a.action_type %></code></td>
<td><%= a.cooldown_seconds %>s</td>
<td>
<span class="badge <%= a.enabled ? 'badge-green' : 'badge-grey' %>">
<%= a.enabled ? 'on' : 'off' %>
</span>
</td>
<td style="display:flex; gap:0.5rem;">
<form method="POST" action="/actions/<%= a.id %>/test"><button type="submit" class="outline" style="padding:0.2rem 0.6rem; font-size:0.8rem;">Test</button></form>
<form method="POST" action="/actions/<%= a.id %>/toggle"><button type="submit" class="outline" style="padding:0.2rem 0.6rem; font-size:0.8rem;"><%= a.enabled ? 'Disable' : 'Enable' %></button></form>
<form method="POST" action="/actions/<%= a.id %>/delete"><button type="button" data-confirm class="outline" style="padding:0.2rem 0.6rem; font-size:0.8rem; color:#f88;">Delete</button></form>
</td>
</tr>
<% } %>
</tbody>
</table>
</figure>
<% } %>