Skip to content

feat(web): mobile image upload to active session via paste dialog#101

Merged
Ark0N merged 1 commit into
Ark0N:masterfrom
TeigenZhang:feat/mobile-image-upload
Jun 1, 2026
Merged

feat(web): mobile image upload to active session via paste dialog#101
Ark0N merged 1 commit into
Ark0N:masterfrom
TeigenZhang:feat/mobile-image-upload

Conversation

@TeigenZhang
Copy link
Copy Markdown
Contributor

Summary

Adds a mobile-friendly way to send images into the active Claude session. A paste dialog (reachable from the mobile keyboard accessory bar) lets the user pick/paste an image, which is uploaded and forwarded to the running session.

Changes

  • image-input.js: paste-dialog upload flow for the active session
  • keyboard-accessory.js: entry point button on the mobile accessory bar
  • session-routes.ts: backend endpoint to receive the uploaded image
  • mobile.css: dialog/button styling
  • .gitignore: ignore upload scratch artifacts

Test plan

  • tsc --noEmit passes
  • Mobile: paste/upload an image, confirm it reaches the session

- Extend the keyboard accessory paste dialog with an image picker
  (camera / photo library) plus best-effort image paste, routing
  selected files through the existing _uploadAndInsertImages pipeline
- Re-encode images to standard JPEG/PNG in the browser before upload,
  so mislabeled gallery images (e.g. MIUI WebP claiming image/jpeg)
  pass the server magic-byte check; PNG keeps transparency, GIF passes
  through untouched, decode failures fall back to the original file
- Log the real byte header on the paste-image magic-mismatch branch to
  pin down any remaining format mismatches without a guessing loop
- Ignore the runtime .claude-images/ upload directory
@Ark0N
Copy link
Copy Markdown
Owner

Ark0N commented Jun 1, 2026

Thank you as always for contributing, @TeigenZhang! 🙏

Reviewed and verified locally on the PR branch:

  • tsc --noEmit, lint, format:check, and npm run build (esbuild) all clean
  • node --check clean on both image-input.js and keyboard-accessory.js
  • ✅ Integration confirmed: the new dialog routes through the existing app._uploadAndInsertImages()/api/sessions/:id/paste-image pipeline, and _normalizeImageForUpload is defined once

Really like the client-side re-encode to dodge the MIUI WebP/HEIF "declared image/jpeg but magic bytes disagree" trap, the PNG-vs-JPEG branch that preserves transparency, the animated-GIF pass-through, and the graceful fall-back-to-original on decode failure. The server-side magic-mismatch diagnostic is a nice complement. Merging now.

@Ark0N Ark0N merged commit ec38fd1 into Ark0N:master Jun 1, 2026
1 check 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