fix: first /tmp file poll is baseline only, no longer overrides config
On page load the first poll counted as a change and applied the file value, so a stale /tmp file could flip the mode set by the Plasma config ~800ms after startup. Record the baseline silently; only real changes toggle modes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HtPHsTnDcLVSCiF5FGHZj
This commit is contained in:
parent
39bc5d0794
commit
f20d8adf4f
1 changed files with 6 additions and 3 deletions
|
|
@ -1996,7 +1996,8 @@ function setBaladaMode(on) {
|
|||
function toggleBalada() { setBaladaMode(!balada); }
|
||||
|
||||
/* Polling de arquivos — só reage a MUDANÇAS no arquivo; um arquivo parado
|
||||
em "1" não fica religando o modo e brigando com o outro toggle */
|
||||
em "1" não fica religando o modo e brigando com o outro toggle.
|
||||
A primeira leitura é só baseline: arquivo velho não sobrescreve a config. */
|
||||
let baladaFileVal = null;
|
||||
(function pollBaladaFile() {
|
||||
fetch('file:///tmp/skeledance-balada?t=' + Date.now())
|
||||
|
|
@ -2004,8 +2005,9 @@ let baladaFileVal = null;
|
|||
.then(t => {
|
||||
const v = t.trim();
|
||||
if (v === baladaFileVal) return;
|
||||
const first = baladaFileVal === null;
|
||||
baladaFileVal = v;
|
||||
setBaladaMode(v === '1');
|
||||
if (!first) setBaladaMode(v === '1');
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => setTimeout(pollBaladaFile, 800));
|
||||
|
|
@ -2141,8 +2143,9 @@ let chuvaFileVal = null;
|
|||
.then(t => {
|
||||
const v = t.trim();
|
||||
if (v === chuvaFileVal) return;
|
||||
const first = chuvaFileVal === null;
|
||||
chuvaFileVal = v;
|
||||
setChuvaMode(v === '1');
|
||||
if (!first) setChuvaMode(v === '1');
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => setTimeout(pollChuvaFile, 800));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue