C2S inbox carries friends' media as AS2 attachments
Shaer showed images on own posts (outbox serialises attachment) but not on
friends' posts: the C2S inbox GET built its Create(Note) items without the
stored media. The timeline rows already keep media_json ([{url, type}],
written on the inbound Create); it just never reached the wire. A new pure
helper maps it to an AS2 attachment array so clients render friends' images
and audio exactly like own outbox posts.
Changed files:
src/services/ActivityPubService.js
- timelineAttachments(mediaJson): media_json -> AS2 attachment array
(Document + mediaType + url); empty or malformed JSON yields
undefined and never blocks the item
- exported alongside getTimeline
src/routes/activitypub.js
- inbox GET: object.attachment = AP.timelineAttachments(t.media_json)
test/c2s-inbox.test.js
- covers the mapping, the unknown-mediaType case, dropped rows without
url, and malformed media_json (148 tests total, all green)
Alt text is not in media_json yet, so attachment.name stays empty for now.
-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>