Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<keyword>/` 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
Expand All @@ -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
Expand Down Expand Up @@ -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)
```

---
Expand Down Expand Up @@ -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
```

Expand All @@ -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
}
```
Expand All @@ -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.
Expand Down
Loading