zebra-spaces: deploy TDZ fix + self-capture diagnostics
This commit is contained in:
parent
f57733ebd3
commit
5a68c56963
1 changed files with 18 additions and 11 deletions
|
|
@ -1625,6 +1625,16 @@ function renderIdentity(){
|
|||
if (el) el.textContent = myKeys ? myKeys.pubHex : '';
|
||||
}
|
||||
|
||||
/* Transcribe-state declarations live up here (not next to the Whisper
|
||||
* code further down) so the click-handler binding + restore block
|
||||
* just below CAN read transcribeEnabled without tripping a TDZ
|
||||
* error. Model is cached after first download so subsequent loads
|
||||
* spin the worker up fast. Fox 2026-06-05: "transcribe states
|
||||
* should be saved in localstorage to survive on refresh." */
|
||||
const TRANSCRIBE_KEY = 'zspc:transcribe-on';
|
||||
let transcribeEnabled = false;
|
||||
try { if (localStorage.getItem(TRANSCRIBE_KEY) === '1') transcribeEnabled = true; } catch(_){}
|
||||
|
||||
$('btn-vault').addEventListener('click', () => $('vault-panel').classList.toggle('hidden'));
|
||||
$('btn-transcribe').addEventListener('click', () => toggleTranscribe().catch(e => logLine('err','transcribe toggle: '+e.message)));
|
||||
/* If transcribe was on at the previous session, restore the state
|
||||
|
|
@ -2217,13 +2227,9 @@ function transcribeViaWorker(chunk){
|
|||
});
|
||||
}
|
||||
|
||||
/* Transcribe state persists in localStorage so refresh restores the
|
||||
* user's preference. Model is cached after first download so subsequent
|
||||
* loads spin the worker up fast. Fox 2026-06-05: "transcribe states
|
||||
* should be saved in localstorage to survive on refresh." */
|
||||
const TRANSCRIBE_KEY = 'zspc:transcribe-on';
|
||||
let transcribeEnabled = false;
|
||||
try { if (localStorage.getItem(TRANSCRIBE_KEY) === '1') transcribeEnabled = true; } catch(_){}
|
||||
/* (transcribeEnabled + TRANSCRIBE_KEY are declared earlier near the
|
||||
* top of the script so the restore-from-localStorage block at the
|
||||
* button-binding site doesn't trip a TDZ error.) */
|
||||
/* whisper-tiny.en hallucinations on silence / low-energy chunks. The
|
||||
* RMS gate in the capture worklet catches dead silence; this set
|
||||
* catches what gets past it — quiet-room ambient with the same
|
||||
|
|
@ -2336,7 +2342,8 @@ async function handleWhisperChunk(uuid, chunk){
|
|||
* the user's handle. */
|
||||
let _selfCapture = null;
|
||||
async function startSelfCapture(){
|
||||
if (_selfCapture || !micStream) return;
|
||||
if (_selfCapture){ logLine('', 'whisper: self capture already running'); return; }
|
||||
if (!micStream){ logLine('', 'whisper: self capture skip (no micStream yet)'); return; }
|
||||
/* audioCtx may not exist yet for a host alone in the room (no
|
||||
* remote speakers have triggered attachAudioStreamViaWorklet). Make
|
||||
* sure it's up before we try to attach a worklet to it. Resume it
|
||||
|
|
@ -2350,7 +2357,7 @@ async function startSelfCapture(){
|
|||
try { audioCtx.resume(); } catch(_){}
|
||||
}
|
||||
const ok = await loadWhisperCaptureWorklet(audioCtx);
|
||||
if (!ok) return;
|
||||
if (!ok){ logLine('err','self capture: worklet module load failed'); return; }
|
||||
try {
|
||||
const src = audioCtx.createMediaStreamSource(micStream);
|
||||
const cap = new AudioWorkletNode(audioCtx, 'whisper-capture');
|
||||
|
|
@ -7413,8 +7420,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');
|
|||
|
||||
<footer style="margin:2.2rem auto 0;font-size:0.65rem;color:#999;line-height:1.7;word-break:break-all;font-family:monospace">
|
||||
<span id="pi-seal" style="color:#777;cursor:default;user-select:none" title="">page integrity</span> · built <span class="stamp-date">2026-06-05</span><br>
|
||||
md5 <span class="stamp-md5">f21110e1e23d66443bea1dc35f0f5fdc</span><br>
|
||||
sha256 <span class="stamp-sha">08d96f30022dda20daa30401ceda2912abc2f3889a28e7a8b52de4bfcc3684e3</span><br>
|
||||
md5 <span class="stamp-md5">9aa06e957f35ac7f764fb8c97bb3c634</span><br>
|
||||
sha256 <span class="stamp-sha">46c487137a3aabfca6d136a0164676f4f07d3a727223fce109b42b339dae3eb5</span><br>
|
||||
<span style="color:#bbb">hashes are of this page with these two fields zeroed — to verify, blank them and re-hash</span><br>
|
||||
<span style="color:#bbb">one self-contained file — <strong>save a copy</strong> and verify against these hashes; point at your own servers with ?signal= and ?turncred=, or <a href="host-your-own.html" style="color:#999">host your own community</a></span>
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue