Skip to content

v2.0.1 — OCR scan-PDF + CSP + Accessibility

Choose a tag to compare

@dripips dripips released this 13 May 08:12

v2.0.1 — Polish pass

Three quality-focused improvements without breaking changes.

📄 OCR scan-PDF — реально работает

Раньше `TextExtractor#extract_from_image_pdf` возвращал "ocr_pdf_not_implemented_locally". Теперь — полноценная цепочка:

`scan PDF → pdftoppm (poppler) → PNG per page → tesseract (rus+eng) → join → text`

  • Dockerfile уже содержит `poppler-utils` + `tesseract-ocr-rus/eng` — на продакшен работает из коробки
  • Cached detection of `pdftoppm` (class-level singleton) → не shell-out'ит каждый раз
  • Windows dev / setup без OCR-инструментов получает `empty_result("poppler_not_installed")` — graceful

🛡️ CSP report-only в production

Foundation для CSP. Сейчас в report-only — браузер шлёт violations но ничего не блокирует. Через 2 недели наблюдения и устранения false-positive → можно включать enforce.

  • `config/initializers/content_security_policy.rb` — реальная политика с CDN allowlist (jsdelivr, google-fonts, mc.webvisor / mc.yandex для Metrika)
  • `POST /csp_violations` принимает оба формата (классический `csp-report` + новый reporting-api array), пишет через `Rails.error.report` в `log/errors.log`

♿ Accessibility quick wins

  • Skip-to-main link — keyboard-only юзеры миновают sidebar+topbar одним `Tab`
  • Universal `:focus-visible` outline (3px blue) — WCAG 2.1 minimum
  • Notifications bell с aria-label с unread count для screen-reader'ов

Specs

  • +12 examples (132 total), 0 failures
  • Rubocop: 0 offenses on 258 files
  • Zeitwerk: clean

Next: v2.1

Multi-tenant cleanup (replace remaining `Company.kept.first` callsites) + end-to-end test with two tenants.