From 1fe5c6347db9d844e9aa4f85cb127f9d3d9b2bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A2=D1=80=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Sat, 12 Sep 2026 18:09:06 +0300 Subject: [PATCH] ui: do not show 'initializing' when no card is inserted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The message branch treated the static auto_equip config flag as if initialization were in progress, so with auto-equip on (default) a cardless server showed 'Card inserted — initializing...' instead of the no-card message. The initializing state now requires equipping or an actually present card with auto-equip enabled; regression test added. SW cache v106 -> v107. --- frontend/index.html | 2 +- frontend/sw.js | 2 +- frontend/tests/card_state.test.js | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 2b25ad4..3696d42 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -6582,7 +6582,7 @@ function pysimCardStateUpdate(status) { pysimSetConnected(false); const statusEl = document.getElementById('pysim-status'); if (statusEl && statusEl.textContent.trim() !== '') { - if (status.equipping || status.auto_equip) { + if (status.equipping || (status.card_present && status.auto_equip)) { statusEl.innerHTML = '' + esc(t('Card inserted — initializing...')) + ''; } else if (status.card_present) { statusEl.innerHTML = '' + esc(t('Card inserted — press Equip')) + ''; diff --git a/frontend/sw.js b/frontend/sw.js index fa26800..36e885c 100644 --- a/frontend/sw.js +++ b/frontend/sw.js @@ -1,4 +1,4 @@ -const CACHE = 'otaman-v106'; +const CACHE = 'otaman-v107'; const URLS = [ 'index.html', 'help.html', diff --git a/frontend/tests/card_state.test.js b/frontend/tests/card_state.test.js index bd7af8e..335a338 100644 --- a/frontend/tests/card_state.test.js +++ b/frontend/tests/card_state.test.js @@ -120,3 +120,10 @@ test('availability state and control gating follow server/card state', () => { assert.strictEqual(pysimControlDisabled('card', 'card'), false); assert.strictEqual(pysimControlDisabled('server', 'card'), false); }); + +test('no card with auto-equip enabled still shows the no-card message', () => { + const { el } = setup(); + pysimCardStateUpdate(status({ connected: false, card_present: false, auto_equip: true })); + assert.ok(el.innerHTML.includes('No card detected'), el.innerHTML); + assert.ok(!el.innerHTML.includes('initializing'), el.innerHTML); +});