LinkedIn publishing works again; rename Inbox to Posts

LinkedIn:
- The API version was fixed at 202501, retired by LinkedIn (426
  NONEXISTENT_VERSION). It's now the month before last, stepping back a
  month (up to four) if LinkedIn says a version isn't active.
- The versioned Posts API needs a title for a link's article card (422).
  Supermarket reads the linked page's title and description and sends
  them, falling back to the page's address as the title.
Tested for real: a post with a link went out to the member's profile.

Inbox is now Posts: the menu, page, messages and docs; the page moves to
/posts, and /inbox redirects there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 12:50:06 -07:00
co-authored by Claude Opus 5.5
parent 7733672706
commit 4b2d791909
21 changed files with 273 additions and 73 deletions
+11 -1
View File
@@ -16,6 +16,7 @@ import (
"supermarket/internal/fetcher"
"supermarket/internal/oauth"
"supermarket/internal/secrets"
"supermarket/internal/site"
)
// fetchMaxResults is how many posts or videos one source returns per fetch.
@@ -99,7 +100,16 @@ type linkedInPublisher struct{ c *linkedin.Client }
// Publish attaches the source link as an article preview.
func (p linkedInPublisher) Publish(ctx context.Context, post content.Post) (string, error) {
return p.c.PostUpdate(ctx, post.Text, post.SourceURL)
if post.SourceURL == "" {
return p.c.PostUpdate(ctx, post.Text, nil)
}
// LinkedIn wants the card's title from us. A page that can't be read
// still gets a card, titled with its address.
link := &linkedin.Link{URL: post.SourceURL}
ictx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
link.Title, link.Description, _ = site.PageInfo(ictx, post.SourceURL, "Supermarket/1 (link preview)")
return p.c.PostUpdate(ctx, post.Text, link)
}
type redditPublisher struct {