From 5b9e821d6d8361048d5117ffb59681ba3619714e 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 17:58:30 +0300
Subject: [PATCH] ui: gate controls by server/card state; move Custom files to
Profiler
Availability model: server-down / server-up-no-card / card-equipped.
- header shows a symbolic indicator dot (red/yellow/green, tooltip)
- a 5s probe tracks /api/version+/api/status while not fully ready; the
2s status poll takes over once connected
- controls declare data-needs='server' or 'card'; disabled + tooltip when
the state does not satisfy them: equip (server), status/reset, file
manager read/save/edit, raw APDU, profile-from-card, new snapshot,
profiler list Check card, event Send, RAM install/explore delete,
STK menu, Send STATUS, Verify vs pySim (server), pySim execute (server),
PLI save/poll toggle (server)
- pysimConnect no longer conflates server and card: it records both and
Connect stays usable without a card
- ramSendOta/ramInstallCap now use pysimFetch instead of raw fetch
(relative /api URLs broke custom server URLs)
Custom files moved from the Card reader sub-tabs to the Profiler list
tabs (Profiles / Card snapshots / Custom files); help/README/AGENTS
updated. Tests: availability gating, indicator structure, moved tab.
SW cache v103 -> v104.
---
README.md | 25 ++--
README_RUS.md | 25 ++--
frontend/help-ru.html | 17 +--
frontend/help.html | 17 +--
frontend/index.html | 205 +++++++++++++++++++++---------
frontend/sw.js | 2 +-
frontend/tests/card_state.test.js | 26 +++-
frontend/tests/html.test.js | 7 +
frontend/tests/profiler.test.js | 14 +-
9 files changed, 235 insertions(+), 103 deletions(-)
diff --git a/README.md b/README.md
index 2d17bbd..1e1aba3 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ npm run build
## Interface
-Five top-level tabs: **Remote APDU**, **SCP80**, **Card reader**, **Profiler**, and **Phone simulator**. **Remote APDU** and **SCP80** use pill sub-tabs; the Card reader tab has four sub-tabs: **File manager**, **Custom files**, **pySim command line**, and **Raw APDU**.
+Five top-level tabs: **Remote APDU**, **SCP80**, **Card reader**, **Profiler**, and **Phone simulator**. **Remote APDU** and **SCP80** use pill sub-tabs; the Card reader tab has three sub-tabs: **File manager**, **pySim command line**, and **Raw APDU**; the Profiler tab lists **Profiles**, **Card snapshots**, and **Custom files**.
---
@@ -490,17 +490,6 @@ Browse the UICC filesystem in a tree view. Files are shown with names, FIDs, and
- **Edit** — switch to edit mode, modify hex data, click **Save** to write back
- **Raw / Decoded** — toggle between hex dump and pysim-decoded JSON view
-### Custom Files
-
-Files not in pysim's model can be added manually:
-
-1. Switch to the **Custom files** sub-tab
-2. Enter the file path (e.g., `3F00/6F46`) and an alias (e.g., `EF.SPN`)
-3. Click **Add** — the file appears in the tree in italics (unverified)
-4. Click the file to verify existence — on success, it behaves like a model file
-
-Custom files persist in `localStorage` across sessions. Export/import as JSON for sharing.
-
### Command Hints
Type a command name in the **pySim command line** input. Usage hints appear as a tooltip after 300ms. Command autocomplete suggestions appear above the input.
@@ -540,6 +529,18 @@ The list view has two tabs — **Profiles** and **Card snapshots**. A snapshot i
---
+
+#### Custom files
+
+Files not in pysim's model can be added manually:
+
+1. Switch to the **Custom files** tab in the Profiler list
+2. Enter the file path (e.g., `3F00/6F46`) and an alias (e.g., `EF.SPN`)
+3. Click **Add** — the file appears in the tree in italics (unverified)
+4. Click the file to verify existence — on success, it behaves like a model file
+
+Custom files persist in `localStorage` across sessions. Export/import as JSON for sharing.
+
## Phone simulator
The **Phone simulator** tab provides real-time CAT session interaction. It has two pills: **Phone** (STK menu, STATUS and polling, subscribed events, proactive command log) and **TR Config** (response data injected into TERMINAL RESPONSEs for proactive commands).
diff --git a/README_RUS.md b/README_RUS.md
index cc7642a..ec4b68d 100644
--- a/README_RUS.md
+++ b/README_RUS.md
@@ -31,7 +31,7 @@ npm run build
## Интерфейс
-Пять вкладок: **Remote APDU**, **SCP80**, **Card reader**, **Profiler** и **Phone simulator**. Вкладки Remote APDU и SCP80 используют пиллы-подвкладки; во вкладке Card reader четыре подвкладки: **File manager**, **Custom files**, **pySim command line** и **Raw APDU**.
+Пять вкладок: **Remote APDU**, **SCP80**, **Card reader**, **Profiler** и **Phone simulator**. Вкладки Remote APDU и SCP80 используют пиллы-подвкладки; во вкладке Card reader три подвкладки: **File manager**, **pySim command line** и **Raw APDU**; во вкладке Profiler — **Profiles**, **Card snapshots** и **Custom files**.
---
@@ -464,17 +464,6 @@ Delivery PoR (SPI2 `01`) проще — карта возвращает PoR на
- **Edit** — режим редактирования, измените hex-данные и нажмите **Save** для записи
- **Raw / Decoded** — переключение между hex-дампом и декодированным JSON
-### Пользовательские файлы
-
-Файлы, отсутствующие в модели pysim, можно добавить вручную:
-
-1. Перейдите на вкладку **Custom files**
-2. Введите путь (например, `3F00/6F46`) и псевдоним (например, `EF.SPN`)
-3. Нажмите **Add** — файл появится в дереве курсивом (непроверенный)
-4. Кликните для проверки существования — при успехе работает как обычный файл
-
-Пользовательские файлы сохраняются в `localStorage`. Экспорт/импорт в JSON для обмена.
-
### Подсказки команд
Введите имя команды в **pySim command line**. Подсказки по использованию появляются через 300 мс. Автодополнение команд — над полем ввода.
@@ -514,6 +503,18 @@ Delivery PoR (SPI2 `01`) проще — карта возвращает PoR на
---
+
+#### Пользовательские файлы
+
+Файлы, отсутствующие в модели pysim, можно добавить вручную:
+
+1. Перейдите на вкладку **Custom files** в списке профайлера
+2. Введите путь (например, `3F00/6F46`) и псевдоним (например, `EF.SPN`)
+3. Нажмите **Add** — файл появится в дереве курсивом (непроверенный)
+4. Кликните для проверки существования — при успехе работает как обычный файл
+
+Пользовательские файлы сохраняются в `localStorage`. Экспорт/импорт в JSON для обмена.
+
## Симулятор телефона
Вкладка **«Симулятор телефона»** обеспечивает взаимодействие с CAT-сессией в реальном времени. Две подвкладки: **«Телефон»** (меню STK, STATUS и опрос, подписанные события, журнал проактивных команд) и **«Конфигурация TR»** (данные ответов, подставляемые в TERMINAL RESPONSE для проактивных команд).
diff --git a/frontend/help-ru.html b/frontend/help-ru.html
index e12a58c..e35cfb6 100644
--- a/frontend/help-ru.html
+++ b/frontend/help-ru.html
@@ -44,7 +44,7 @@
Подключение к локальному pysim-otaman-server для работы с картой: введите URL сервера (по умолчанию Подключение к локальному pysim-otaman-server для работы с картой: введите URL сервера (по умолчанию Дерево файловой системы отображается слева; выбор файла открывает панель деталей справа. Добавление файлов, не покрытых моделью pySim: введите полный путь (например, Выполнение любых команд pySim-shell с подсказками (300 мс) и автодополнением. Отправка произвольного APDU и просмотр ответа.
@@ -314,7 +314,7 @@
localStorage и сохраняется между перезагрузками.4. Вкладка «Картридер» (pySim)
- http://127.0.0.1:8080) и нажмите Подключиться. Область статуса показывает состояние ридера/карты, а Подключить карту (пере)инициализирует карту после вставки. Подвкладки: Файловый менеджер, Пользовательские файлы, Командная строка pySim и Отправка APDU. «Профайлер» и «Симулятор телефона» — отдельные вкладки верхнего уровня.http://127.0.0.1:8080) и нажмите Подключиться. Область статуса показывает состояние ридера/карты, а Подключить карту (пере)инициализирует карту после вставки. Подвкладки: Файловый менеджер, Командная строка pySim и Отправка APDU. «Профайлер» и «Симулятор телефона» — отдельные вкладки верхнего уровня.4.1 Файловый менеджер
4.2 Пользовательские файлы
- 3F00/7F20/6F46) и псевдоним (например, EF.SPN), затем нажмите Добавить; добавленные файлы появляются в дереве «Файловый менеджер». Список сохраняется в localStorage; обмен — Экспорт в JSON / Экспорт в файл и Импорт из файла / Вставить и импортировать / Импорт JSON из буфера.4.3 Командная строка pySim
+ 4.2 Командная строка pySim
4.4 Отправка APDU
+ 4.3 Отправка APDU
4.5 Сценарии использования
+4.4 Сценарии использования
Сценарий A — Работа с файлами, не входящими в модель pySim («Пользовательские файлы»)
@@ -406,6 +403,10 @@
Пользовательские файлы
+
Добавление файлов, не покрытых моделью pySim: введите полный путь (например, 3F00/7F20/6F46) и псевдоним (например, EF.SPN), затем нажмите Добавить; добавленные файлы появляются в дереве «Файловый менеджер». Список сохраняется в localStorage; обмен — Экспорт в JSON / Экспорт в файл и Импорт из файла / Вставить и импортировать / Импорт JSON из буфера.
Работа с сессией Card Application Toolkit. Две подвкладки: «Телефон» (меню STK, STATUS и опрос, подписанные события, журнал проактивных команд) и «Конфигурация TR» (данные ответов, подставляемые в TERMINAL RESPONSE для проактивных команд).
diff --git a/frontend/help.html b/frontend/help.html index 0d28186..f2b86a5 100644 --- a/frontend/help.html +++ b/frontend/help.html @@ -44,7 +44,7 @@localStorage and persist across reloads.Connects to a local pysim-otaman-server for live card operations: enter the server URL (default http://127.0.0.1:8080) and press Connect. The status area shows the reader/card state, and Equip card (re)initializes the card after insertion. Sub-tabs: File manager, Custom files, pySim command line, and Raw APDU. The Profiler and Phone simulator are separate top-level tabs.
Connects to a local pysim-otaman-server for live card operations: enter the server URL (default http://127.0.0.1:8080) and press Connect. The status area shows the reader/card state, and Equip card (re)initializes the card after insertion. Sub-tabs: File manager, pySim command line, and Raw APDU. The Profiler and Phone simulator are separate top-level tabs.
The file system tree is displayed on the left; selecting a file opens its detail pane on the right.
@@ -324,16 +324,13 @@Add files that pySim’s model does not cover: enter the full path (e.g. 3F00/7F20/6F46) and an alias (e.g. EF.SPN), then press Add; added files appear in the File manager tree. The list persists in localStorage and can be shared with Export as JSON / Export to file and restored with Import from file / Paste & import / Import JSON from clipboard.
Execute any pySim-shell command with usage hints (300 ms) and autocomplete.
-Send an arbitrary APDU and view the raw response.
-Add files that pySim’s model does not cover: enter the full path (e.g. 3F00/7F20/6F46) and an alias (e.g. EF.SPN), then press Add; added files appear in the File manager tree. The list persists in localStorage and can be shared with Export as JSON / Export to file and restored with Import from file / Paste & import / Import JSON from clipboard.
Interacts with the Card Application Toolkit session. The view has two pills: Phone (STK menu, STATUS and polling, subscribed events, proactive command log) and TR Config (response data injected into TERMINAL RESPONSEs for proactive commands).
diff --git a/frontend/index.html b/frontend/index.html index fbb4dce..5210803 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -20,6 +20,7 @@