Chestny Znak scanner: DataMatrix -> National Catalog КБЖУ prefill

- ChZ module (frontend/js/chzn.js): import an anonymous session (exported from
  the CRPT app with tools/chzn_export.sh) and keep it alive via /authorize/refresh
  — /authorize/anonymous is Play Integrity-gated so BalDav can't mint its own.
  GS1 code normalization (reconstruct the GS separator before AI 93), check ->
  catalogData good_attrs КБЖУ parser (match by attr group + name prefix, since
  producers name the fields differently), optional nutrition/info vitamins.
- chzn_http Rust command: browser UA + returns {status,body} so 204/401/427 drive
  the session/refresh logic.
- Scanner modal (BarcodeDetector camera + photo/manual fallbacks) -> prefill the
  new-product form; CAMERA permission; settings section to import/refresh session.
- tools/chzn_export.sh: pull + validate the anonymous session from a rooted device.
This commit is contained in:
4aiman 2026-08-27 03:27:15 +03:00
commit c3ec590da5
7 changed files with 511 additions and 11 deletions

3
.gitignore vendored
View file

@ -22,3 +22,6 @@ db_backups/
# Session-local analysis harnesses, copied DBs, pulled 50Hz sensor dumps (large)
test_recovery/
# Честный знак session export (tokens — never commit)
chzn_session.json