From 197692b293a8218a518b182977049993350a5b98 Mon Sep 17 00:00:00 2001 From: aREversez Date: Thu, 16 Jul 2026 22:57:49 +0800 Subject: [PATCH] Update changelog and README to reflect new features and improvements in V1.0.8 --- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++++ README.md | 12 +++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 020cee1..769f4db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,39 @@ into one file for convenience. --- +## [V1.0.8] - 2026-07-14 + +### Features +- **Lightbox image navigation** — while previewing a matched image, press `←` / `→` + to jump to the previous / next match without leaving the lightbox. Floating circular + nav arrows sit in the dark screen margins (outside the image, so they never obscure + content), and an image counter (e.g. `3 / 12`) is centered at the top. +- **Image info in preview** — new `GET /api/image-info` endpoint returns the image + width, height, and file size. The lightbox meta panel now shows the resolution and a + human-readable file size (e.g. `1291 × 800 · 97.7 KB`). + +### Performance & Robustness +- **Cache auto-pruning** — the OCR cache (`ocr_cache/*.json`) and thumbnail cache + (`thumb_cache/*.webp`) are now periodically pruned so they can't grow without bound. + Two new settings, `max_ocr_cache_files` (default 5000) and `max_thumb_cache_files` + (default 3000), cap each cache; the oldest files (by mtime) beyond the limit are + deleted during normal cache writes. +- **`prune_cache_dir` rewrite** — replaced the O(n²) `pop(0)` loop with a single slice, + and clarified the `max_files` contract: negative = unlimited (no prune), 0 = remove + all matching files, positive = keep at most N. + +### Testing & CI +- **E2E scan-stream integration tests** — `TestScanStreamIntegration` drives the full + SSE scan pipeline through `fastapi.testclient.TestClient`: happy-path match + copy, + no-match / no-copy, and bad target dir → `400` with no scan-lock leak. +- **`requirements-test.txt`** — new test-only dependency file pinning `httpx` (required + by `TestClient`). It is not bundled into the packaged app; CI installs it separately. +- **Cross-platform CI** — the workflow now runs the matrix on `ubuntu-latest` **and** + `windows-latest` with `fail-fast: false`, so one OS failing no longer cancels the + other. Fixes the CI break where `TestClient` raised because `httpx` was absent. + +--- + ## [V1.0.7] - 2026-07-12 ### Features diff --git a/README.md b/README.md index 032104e..638f2b3 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ FocusOCR is a lightweight, fully offline desktop web app that scans images for t - **ANY / AND matching** — OR logic copies to per-keyword folders; AND logic creates a single combined folder - **Auto-organized output** — matched images are copied into `dest//` folders with conflict resolution - **Thumbnail gallery** — cached WebP thumbnails, lightbox preview, highlighted OCR snippets +- **Lightbox navigation** — browse matches with `←` / `→` arrow keys (or floating side arrows); an image counter shows position (e.g. `3 / 12`) +- **Image info in preview** — the lightbox shows each image's resolution and file size via `GET /api/image-info` - **Export CSV / JSON** — download match results with one click - **Scan history** — last 10 scans saved in browser; click to restore parameters and gallery - **Folder history** — recent target/dest directories remembered per-field @@ -24,6 +26,7 @@ FocusOCR is a lightweight, fully offline desktop web app that scans images for t - **Scan concurrency protection** — overlapping scans return 409; stale locks from disconnected clients auto-reclaim after 60s - **Toast notifications** — auto-dismissing toasts replace alert() for non-blocking feedback - **OCR result caching** — `~/.focusocr/ocr_cache/` avoids re-scanning unchanged files; configurable toggle in UI +- **Bounded caches** — OCR and thumbnail caches are auto-pruned (oldest-first) to `max_ocr_cache_files` / `max_thumb_cache_files` so disk usage stays capped - **Scan result persistence** — save/load results to `~/.focusocr/results/`; auto-pruned to 20 files; each deletable from the Load Results modal - **Bounding box overlay** — lightbox highlights exactly which text regions matched, mapped by line index (not text content) to avoid duplicate highlights on repeated text - **Confidence filter** — slider (0–1) excludes low-quality OCR text from matching @@ -62,7 +65,9 @@ venv/ tests/ test_ocr_engine.py Unit tests for OCR engine and scan lock test_config.py Unit tests for settings validation - test_app.py Unit tests for API endpoints (results, reveal, lock leak) + test_app.py Unit tests + SSE scan-stream integration tests +requirements.txt Runtime dependencies +requirements-test.txt Test-only dependencies (httpx for TestClient) ``` --- @@ -101,6 +106,7 @@ Server starts on port **9000** (falls back to 9001, 9002...). ### Run tests ```bash +pip install -r requirements-test.txt # httpx, needed by the SSE integration tests python -m unittest discover -s tests -v ``` @@ -118,6 +124,8 @@ Settings stored in `~/.focusocr/config.json`: "max_snippets_per_match": 3, "max_history_per_dir": 5, "max_saved_results": 20, + "max_ocr_cache_files": 5000, + "max_thumb_cache_files": 3000, "enable_ocr_cache": true } ``` @@ -130,6 +138,8 @@ Settings stored in `~/.focusocr/config.json`: | `max_snippets_per_match` | `3` | Snippets shown per match in gallery | | `max_history_per_dir` | `5` | Recent directories remembered | | `max_saved_results` | `20` | Max result files kept in `~/.focusocr/results/` | +| `max_ocr_cache_files` | `5000` | Max OCR cache files kept (oldest pruned first) | +| `max_thumb_cache_files` | `3000` | Max thumbnail cache files kept (oldest pruned first) | | `enable_ocr_cache` | `true` | Skip re-scan of unchanged files | The cache toggle and confidence slider are also available directly in the UI.