ReviewOS

also looking at this

stacks/postline

Bluesky publishing v2: rich-text facets + image upload

#9
Merged glennmichael123 wants to merge feat/bluesky-publishing-v2 into main
8 files +347 -12
9 days ago

Summary

Finishes the two remaining publishing items from #5.

Rich-text facets

  • Links, #hashtags, and @mentions are detected in post text and attached as ATProto facets with UTF-8 byte ranges (not char offsets — emoji-safe, covered by tests)
  • Mentions resolve handle → DID via com.atproto.identity.resolveHandle; unresolvable mentions degrade gracefully to plain text
  • Trailing punctuation is trimmed from links; numeric-only tags and tags inside URLs are skipped
  • Callers can pass precomputed facets to skip auto-detection

Image upload

  • Composer: attach button + filename chip (image types, 1MB cap client- and driver-side)
  • The file flows as multipart through CrosspostPublishAction → PublishContent.media now carries bytes/mimeType alongside url
  • BlueskyService fetches URL-only media server-side; the driver uploads via com.atproto.repo.uploadBlob and embeds app.bsky.embed.images (up to 4)
  • Images take precedence over a link card in the single-embed slot — the link stays clickable via its facet
  • Instagram's existing URL-based flow is untouched

Verification

  • bun test — 13 pass (8 new: facet offsets/trimming/skipping, mention resolution + fallback, blob upload + embed, size cap)
  • bunx --bun pickier . clean, bun run typecheck exit 0
  • Live multipart publish exercised against the dev API (fails only at missing credentials, confirming the file reaches the driver path); attach/clear UI verified in-browser

Refs #5

8 changed files on the files tab, with 0 review threads.

Sign in to comment on this pull request.