Skip to content

Beta: read barcodes from a photo or screenshot - #14

Merged
Oliver-Johnson merged 9 commits into
betafrom
claude/beta-barcode-image
Oct 8, 2026
Merged

Oliver-Johnson merged 9 commits into
betafrom
claude/beta-barcode-image

Conversation

@Oliver-Johnson

@Oliver-Johnson Oliver-Johnson commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Requested by Oliver · project thread

Checks

  • I have not edited index.html or sw.js without understanding the PWA cache implications
  • The version string in index.html has been bumped (comes from master as 2026-10-07.4; the beta publish stamps its own -beta version)
  • manifest.json is still valid JSON (unchanged)
  • The app works offline after the change
  • CI passes (validate, sync-server and smoke on Chromium and WebKit)

What this changes

Before: beta.macroslog.co.uk could only scan barcodes with a live camera.

After: merging this publishes the barcode-from-image feature from #13 to beta so it can be tried before master: Barcode from Image on the Scan tab and in a recipe's Scan ingredient dialog, drag a photo onto Log Food or paste a screenshot on a computer, and type a barcode number into Search.

How: claude/beta-barcode-image is beta with the #13 branch merged in, which also brings beta up to date with master (#1 to #6). It is now up to date with beta after #12 (desktop pages) merged: the button and hint sit in the camera half of #12's split Scan tab, the docs summary mentions both features, and the changelog keeps the Beta entry above v2026-10-07.4. The smoke test now opens the Scan tab first, because desktop Log Food opens on Search. Beta's themes and sync are untouched.

Testing done

On this merged tree: the 29 end-to-end checks from #13 and the smoke suite pass (Chromium locally, Chromium and WebKit in CI).

🤖 Generated with Claude Code

https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk

claude added 2 commits October 7, 2026 09:22
Desktops rarely have a camera, so the Scan tab and a recipe's Scan
ingredient dialog get a "Barcode from Image" button. On a computer a photo
can also be dropped onto Log Food or a screenshot pasted. The image is
decoded with the native BarcodeDetector where the browser has one, else
ZXing at a few sizes and angles; slower tryHarder reads must agree across
two passes, which stops blurry codes being misread as another product.

A barcode number typed into Search (valid GTIN check digit) is looked up
directly and shown first. With no camera, the Scan tab hides the empty
viewfinder and points to the image option instead of a permissions error.

Adds a smoke test with a photo fixture; CI installs @zxing/library so the
test can serve it locally. Version 2026-10-07.3, docs updated.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk
Brings master up to date on beta along with the feature. The changelog
keeps the Beta entry above the v2026-10-07.3 release.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk
@Oliver-Johnson Oliver-Johnson self-assigned this Oct 7, 2026
claude added 2 commits October 7, 2026 09:32
The new smoke test timed out on all three WebKit devices in CI while
passing on Chromium. WebKit can expose BarcodeDetector without a working
backend, and detect() never settling would leave the image scan stuck.
Only use the native detector for formats it reports, and give up on it
after 3 seconds and fall back to ZXing. The test now reports the scan
status if the sheet doesn't open. Version 2026-10-07.4.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk
claude added 5 commits October 7, 2026 09:38
With the status now reported, the WebKit failure reads "Couldn't open
that image": Playwright's WebKit routes blob: URLs (it only skips data:
and about:), and a blob URL has no hostname, so the block-everything-
external route aborted the photo's object URL. Only http(s) requests are
checked now. Real browsers were never affected.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk
…a branch

Conflicts: the Scan tab's new camera/label halves (Barcode from Image
stays in the camera half), the version (2026-10-07.4 from the feature
branch), the docs summary (now mentions both changes) and the changelog.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk
Log Food opens on Search on desktop once the desktop pages land (#11/#12),
which hides the Barcode from Image button.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wFUsVAFFzEVnLmxe6TiLk
@Oliver-Johnson
Oliver-Johnson merged commit 8180cd7 into beta Oct 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants