FT-WP-0001-T14: upload post images instead of linking them

The adapter fetches visual_url from an allowlisted host (https, image types,
10 MB cap, optional read token) and uploads it as multipart sendPhoto, so the
forge can close without breaking post images.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 5457@bnt-lap001
Assistant-Session: 792bf84a-3783-4f5d-a811-cded61dd2012
This commit is contained in:
tegwick 2026-10-08 20:55:32 +02:00
parent e70c8be67d
commit 86cbb43965
8 changed files with 379 additions and 5 deletions

View file

@ -439,7 +439,7 @@ you have used it is how you find out you cut it in the wrong place.
```task
id: FT-WP-0001-T14
status: todo
status: progress
priority: high
state_hub_task_id: "c822885b-c2a2-57a7-a448-7d1a853a26c0"
```
@ -462,3 +462,14 @@ replaces the media the same way.
No public asset location is improvised for this. A dedicated asset store with
creator and trust management comes later, on its own.
2026-10-08: implemented. `internal/adapter/visual.go` fetches the image from an
allowlisted host: https only, no redirects to other hosts, JPEG/PNG/WebP only,
refused over 10 MB, with an optional `FORGE_READ_TOKEN` sent only to that host.
`BotAPISender.UploadPhoto` sends it as multipart `sendPhoto`. Enabled with
`UPLOAD_VISUALS=true` (on in `scripts/send-post.sh`). Tests cover upload,
refusals, the token never appearing in responses or errors, and the multipart
fields. Dry run fetched the real image. Open: one signed test post to the
private channel (`pr-hall-of-helix/posts/261008T205518-test-image-upload.yaml`).
Editing an existing photo post still edits only the caption; replacing the
image would be a separate change.