ext: /health check blocks recording when the backend is offline, strobing offline alarm in popup
This commit is contained in:
@@ -7,6 +7,18 @@
|
||||
body[data-state=transcribing] { --accent: #2563eb; }
|
||||
body[data-state=done] { --accent: #16a34a; }
|
||||
body[data-state=error] { --accent: #d97706; }
|
||||
body[data-state=offline] { --accent: #dc2626; }
|
||||
#off { margin-bottom: 12px; padding: 12px 14px; border-radius: 8px; background: #fef2f2; border: 2px solid #dc2626; color: #7f1d1d; }
|
||||
#off b { display: block; margin-bottom: 4px; font-size: 15px; color: #b91c1c; }
|
||||
#off ol { margin: 8px 0 0; padding-left: 20px; }
|
||||
body[data-state=offline] #st, body[data-state=offline] #txt { display: none; }
|
||||
body[data-state=offline] #go:disabled { opacity: 1; background: #fecaca; color: #991b1b; }
|
||||
/* Offline alarm: banner, button and dot strobe red/white. 0.4 s per cycle = 2.5 flashes/s, under the 3/s photosensitivity limit.
|
||||
No prefers-reduced-motion opt-out on purpose: Windows with animations off reports "reduce" and would hide the alarm. */
|
||||
body[data-state=offline] #off { animation: strobe .4s steps(1) infinite; }
|
||||
body[data-state=offline] #go:disabled, body[data-state=offline] .dot { animation: strobe .4s steps(1) infinite reverse; }
|
||||
@keyframes strobe { 0% { background: #dc2626; color: #fff; border-color: #fff; } 50% { background: #fff; color: #b91c1c; border-color: #dc2626; } }
|
||||
body[data-state=offline] #off b { color: inherit; }
|
||||
h1 { margin: 0 0 12px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
|
||||
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
|
||||
body[data-state=recording] .dot { animation: pulse 1.2s infinite; }
|
||||
@@ -18,14 +30,27 @@
|
||||
#st { margin-top: 12px; padding: 8px 10px; background: #fff; border: 1px solid #e2e8f0; border-left: 3px solid var(--accent); border-radius: 6px; word-break: break-word; }
|
||||
#txt { margin: 12px 0 0; padding: 10px; white-space: pre-wrap; max-height: 260px; overflow: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; font: 12px/1.45 ui-monospace, Consolas, monospace; }
|
||||
#txt:empty { display: none; }
|
||||
#srv { margin-top: 8px; font-size: 12px; color: #475569; display: flex; align-items: center; gap: 6px; }
|
||||
#srv::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
|
||||
#srv[data-ok=true]::before { background: #16a34a; }
|
||||
#srv[data-ok=false] { color: #dc2626; font-weight: 600; }
|
||||
#srv[data-ok=false]::before { background: #dc2626; }
|
||||
a { display: inline-block; margin-top: 12px; color: #475569; font-size: 12px; }
|
||||
</style>
|
||||
<body data-state="idle">
|
||||
<h1><span class="dot"></span>Teams Whisper</h1>
|
||||
<!-- Shown by popup.js when /health fails and nothing is recording. -->
|
||||
<div id="off" hidden>
|
||||
<b>Backend offline. Recording is NOT possible.</b>
|
||||
The Teams Whisper server (127.0.0.1:18765) is not running, so nothing would be saved.
|
||||
<ol><li>Open Pinokio, then Teams Whisper, then press <b style="display:inline;font-size:inherit">Start</b>.</li><li>Wait until the dot below turns green.</li><li>Press Start here again.</li></ol>
|
||||
</div>
|
||||
<!-- Start/Stop; popup.js drives it. -->
|
||||
<button id="go">Start</button>
|
||||
<!-- Status line, filled by popup.js. -->
|
||||
<div id="st"></div>
|
||||
<!-- Backend health (/health), refreshed every second by popup.js. -->
|
||||
<div id="srv"></div>
|
||||
<!-- Transcript/result text returned by the recorder. -->
|
||||
<pre id="txt"></pre>
|
||||
<!-- mic.html opens in a new tab so the permission prompt can appear; needed once. -->
|
||||
|
||||
Reference in New Issue
Block a user