From f64f2dac7cc57b6951c00da7916477eaa94a4a66 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: Fri, 11 Sep 2026 23:16:14 +0300 Subject: [PATCH] profiler: check a profile against a stored card snapshot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each profile row gets a Check card snapshot button next to Check card. It opens a picker listing the stored snapshots (name, ICCID, date, file count) and runs the profile rules offline against the selected snapshot, showing the usual report titled 'profile — snapshot'. profilerRunRule() accepts an optional data source: profilerLiveSource() (default) wraps /api/select + /api/read, profilerSnapshotSource() serves select/read from the snapshot files. Contents missing from the snapshot are reported as unverifiable errors ('Content not captured in snapshot') rather than mismatches. The shared check loop moved into profilerRunProfile(). Tests for the snapshot source and snapshot-based checks; help docs updated; SW cache v84 -> v85. --- frontend/help-ru.html | 3 +- frontend/help.html | 3 +- frontend/index.html | 96 ++++++++++++++++++++++++++++++--- frontend/sw.js | 2 +- frontend/tests/profiler.test.js | 70 +++++++++++++++++++++++- 5 files changed, 163 insertions(+), 11 deletions(-) diff --git a/frontend/help-ru.html b/frontend/help-ru.html index 06e3157..a412cd8 100644 --- a/frontend/help-ru.html +++ b/frontend/help-ru.html @@ -371,7 +371,7 @@
  • Новый профиль — создаёт пустой набор правил, запросив имя.
  • Профиль с карты — сканирует подключённую карту и создаёт по одному правилу на каждый существующий файл (см. ниже), затем открывает редактор.
  • Импорт профиля — загружает набор правил из JSON-файла (имя хранится внутри JSON).
  • -
  • В каждой строке профиля показаны имя и время создания, а также действия Проверить карту ▶, Редактировать, Экспорт (скачать JSON) и Удалить.
  • +
  • В каждой строке профиля показаны имя и время создания, а также действия Проверить карту ▶, Проверить снимок карты, Редактировать, Экспорт (скачать JSON) и Удалить.
  • Правила файловой системы

    Правила выполняются последовательно. Редактор показывает символьное имя файла pySim (если известно) рядом с путём правила; Добавить правило добавляет правило, Сохранить сохраняет изменения. Правило файловой системы задаётся:

    @@ -391,6 +391,7 @@
  • Новый снимок — запрашивает имя и сканирует карту, затем возвращает к списку.
  • Импорт снимка — загружает снимок из JSON-файла.
  • В каждой строке снимка — Открыть, Экспорт и Удалить. Открыть показывает все захваченные данные только для чтения (сырой FCI с декодированным FCI, содержимое); редактируется только имя снимка.
  • +
  • Проверить снимок карты в строке профиля выполняет правила профиля на выбранном из списка снимке, без картридера. Отчёт такой же, как при проверке карты; файлы, содержимое которых не было захвачено при сканировании, помечаются как непроверяемые ошибки.
  • 5.7 Сценарии использования

    diff --git a/frontend/help.html b/frontend/help.html index 2384636..f8da7db 100644 --- a/frontend/help.html +++ b/frontend/help.html @@ -371,7 +371,7 @@
  • New profile — creates an empty ruleset after prompting for a name.
  • Profile from card — scans the equipped card and generates one rule per existing file (see below), then opens the editor.
  • Import profile — loads a ruleset from a JSON file (the name is stored inside the JSON).
  • -
  • Each profile row shows its name and creation time, with Check card ▶, Edit, Export (download JSON), and Delete actions.
  • +
  • Each profile row shows its name and creation time, with Check card ▶, Check card snapshot, Edit, Export (download JSON), and Delete actions.
  • Filesystem rules

    Rules run sequentially. The editor shows the symbolic pySim name (when known) next to each rule’s path; use Add rule to append one and Save to keep the changes. A filesystem rule is defined by:

    @@ -391,6 +391,7 @@
  • New snapshot — asks for a name and scans the card, then returns to the list.
  • Import snapshot — loads a snapshot from a JSON file.
  • Each snapshot row has Open, Export, and Delete. Open shows all captured data read-only (raw FCI with the decoded FCI, contents); only the snapshot name is editable.
  • +
  • Check card snapshot on a profile row runs the profile rules against a snapshot you pick from the list, without a card reader. The report is the same as a live check; files whose contents were not captured during the scan are reported as unverifiable errors.
  • 5.7 Usage scenarios

    diff --git a/frontend/index.html b/frontend/index.html index 83aac4f..3fb3c04 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -961,6 +961,16 @@ + +