Post images: pick, scale to the server's limit, send #37

Merged
littlefox merged 1 commit from issue-33-post-images into main 2026-10-17 10:14:32 +00:00
Owner

Closes #33

Built on #36 (PR for #32); merge that first.

The composer gets an image field with a preview and a remove button. Files that already fit (JPEG/PNG/GIF/WebP, at most 1600 px, within the budget) are posted as they are. Anything else is scaled on a canvas to a JPEG until it fits. An image alone is posted as subject line plus raw image, as elisp and jskom do. With a caption it is posted as multipart/mixed.

The limit starts at lyskomd's default (128 KiB). When the server answers string-too-long, its status gives the real limit; Kom remembers it and the composer re-scales and retries once.

Verified:

  • e2e post-image.spec.ts: a small PNG is kept; a 2400×1800 noisy PNG becomes a JPEG and the whole text fits; caption plus image becomes multipart; removing the image works.
  • Devserver integration test text_limit_is_learnt: status = 131072, and an image of exactly the budget is accepted.
  • Full e2e 29/29.

Not verified: the desktop file dialog (GTK chooser via WebKitGTK). The smoke test does not drive file dialogs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8

Closes #33 Built on #36 (PR for #32); merge that first. The composer gets an image field with a preview and a remove button. Files that already fit (JPEG/PNG/GIF/WebP, at most 1600 px, within the budget) are posted as they are. Anything else is scaled on a canvas to a JPEG until it fits. An image alone is posted as subject line plus raw image, as elisp and jskom do. With a caption it is posted as multipart/mixed. The limit starts at lyskomd's default (128 KiB). When the server answers string-too-long, its status gives the real limit; Kom remembers it and the composer re-scales and retries once. Verified: - e2e post-image.spec.ts: a small PNG is kept; a 2400×1800 noisy PNG becomes a JPEG and the whole text fits; caption plus image becomes multipart; removing the image works. - Devserver integration test text_limit_is_learnt: status = 131072, and an image of exactly the budget is accepted. - Full e2e 29/29. Not verified: the desktop file dialog (GTK chooser via WebKitGTK). The smoke test does not drive file dialogs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
Write aux items: requests to readers, cross-references, fast replies
All checks were successful
ci / check (push) Successful in 5m56s
ci / e2e (push) Successful in 10m7s
ci / desktop (push) Successful in 11m52s
9268c6d0aa
The composer can now set no-comments, personal-comment,
request-confirmation and world-readable, and add cross-references to
texts, conferences and persons. Any text gets a fast reply. These are the
items the elisp client writes (D-024). Aux data is Latin-1 when it fits,
otherwise UTF-8, and is read back UTF-8 first.

Refs #32

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
Post images: pick, scale to the server's limit, send
All checks were successful
ci / check (push) Successful in 6m3s
ci / e2e (push) Successful in 9m40s
ci / desktop (push) Successful in 10m8s
ae53de722a
Like jskom (D-024): the composer takes an image file, keeps it as it is
when it already fits, otherwise scales it down on a canvas to a JPEG.
The canvas works the same in the browser and the desktop webview. Alone
the image is posted the elisp/jskom way (subject line plus raw image);
with a caption it is posted as multipart/mixed. The server's text limit
is learnt from string-too-long, and sending re-scales and retries once.

Refs #33

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
Sign in to join this conversation.
No description provided.