Overlay reloads itself after a deploy (boot ID), versioned asset URLs
OBS kept running the old alert scripts after a deploy, so TTS redeems fell back to the cassette with no voice. The server now sends a boot ID on every WebSocket connect; an overlay built with a different ID reloads itself. Asset URLs carry ?v=<boot ID> so the reload never uses cached files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9e356b0875
commit
5f61b1ebe1
4 changed files with 30 additions and 16 deletions
|
|
@ -6,14 +6,14 @@
|
|||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Caveat:wght@700&family=Nunito:wght@800;900&display=swap">
|
||||
<% const has = p => parts.includes(p); %>
|
||||
<% if (has('alerts')) { %>
|
||||
<link rel="stylesheet" href="/alerts/polaroid.css">
|
||||
<link rel="stylesheet" href="/alerts/cassette.css">
|
||||
<link rel="stylesheet" href="/alerts/fx.css">
|
||||
<link rel="stylesheet" href="/alerts/polaroid.css?v=<%= boot %>">
|
||||
<link rel="stylesheet" href="/alerts/cassette.css?v=<%= boot %>">
|
||||
<link rel="stylesheet" href="/alerts/fx.css?v=<%= boot %>">
|
||||
<% } %>
|
||||
<% if (has('chat')) { %><link rel="stylesheet" href="/chat/chat.css"><% } %>
|
||||
<% if (has('poll')) { %><link rel="stylesheet" href="/alerts/poll.css"><% } %>
|
||||
<% if (has('hypebar')) { %><link rel="stylesheet" href="/alerts/hypebar.css"><% } %>
|
||||
<% if (has('raid')) { %><link rel="stylesheet" href="/alerts/raidcard.css"><% } %>
|
||||
<% if (has('chat')) { %><link rel="stylesheet" href="/chat/chat.css?v=<%= boot %>"><% } %>
|
||||
<% if (has('poll')) { %><link rel="stylesheet" href="/alerts/poll.css?v=<%= boot %>"><% } %>
|
||||
<% if (has('hypebar')) { %><link rel="stylesheet" href="/alerts/hypebar.css?v=<%= boot %>"><% } %>
|
||||
<% if (has('raid')) { %><link rel="stylesheet" href="/alerts/raidcard.css?v=<%= boot %>"><% } %>
|
||||
<%# Now playing (Feishin) is switched off for now. To bring it back: add 'nowplaying' to PARTS in
|
||||
src/routers/overlay.js, uncomment the /nowplaying route in src/app.js and restore the NOWPLAYING lines here:
|
||||
<link rel="stylesheet" href="/alerts/nowplaying.css"> (inside an if (has('nowplaying')))
|
||||
|
|
@ -72,15 +72,15 @@
|
|||
<video id="alert-video" autoplay></video><% } %>
|
||||
|
||||
<script src="/vendor/tmi.min.js"></script>
|
||||
<% if (has('chat')) { %><script src="/chat/chat.js"></script><% } %>
|
||||
<% if (has('chat')) { %><script src="/chat/chat.js?v=<%= boot %>"></script><% } %>
|
||||
<% if (has('alerts')) { %>
|
||||
<script src="/alerts/cassette.js"></script>
|
||||
<script src="/alerts/fx.js"></script>
|
||||
<script src="/alerts/polaroid.js"></script>
|
||||
<script src="/alerts/cassette.js?v=<%= boot %>"></script>
|
||||
<script src="/alerts/fx.js?v=<%= boot %>"></script>
|
||||
<script src="/alerts/polaroid.js?v=<%= boot %>"></script>
|
||||
<% } %>
|
||||
<% if (has('poll')) { %><script src="/alerts/poll.js"></script><% } %>
|
||||
<% if (has('hypebar')) { %><script src="/alerts/hypebar.js"></script><% } %>
|
||||
<% if (has('raid')) { %><script src="/alerts/raidcard.js"></script><% } %>
|
||||
<% if (has('poll')) { %><script src="/alerts/poll.js?v=<%= boot %>"></script><% } %>
|
||||
<% if (has('hypebar')) { %><script src="/alerts/hypebar.js?v=<%= boot %>"></script><% } %>
|
||||
<% if (has('raid')) { %><script src="/alerts/raidcard.js?v=<%= boot %>"></script><% } %>
|
||||
<script>
|
||||
const S = <%- JSON.stringify(settings) %>;
|
||||
window.S = S; // chat.js reads message_timeout / max_messages from here (settings_update keeps it current)
|
||||
|
|
@ -151,6 +151,8 @@
|
|||
|
||||
ws.onmessage = (e) => {
|
||||
const msg = JSON.parse(e.data);
|
||||
// server restarted with (possibly) new code: reload this page so OBS runs the current alerts
|
||||
if (msg.type === 'hello') { if (msg.boot !== '<%= boot %>') setTimeout(() => location.reload(), 1500); return; }
|
||||
if (msg.type === 'settings_update') {
|
||||
Object.assign(S, msg.settings);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue