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
+8 -4
View File
@@ -116,9 +116,13 @@ func (s *Server) Handler() (http.Handler, error) {
mux.HandleFunc("POST /content/{id}/items", s.contentItems)
mux.HandleFunc("GET /content/scheduled", s.scheduledPage)
mux.HandleFunc("GET /content/published", s.publishedPage)
mux.HandleFunc("GET /inbox", s.inboxPage)
mux.HandleFunc("GET /posts", s.inboxPage)
// Posts was called the Inbox, and before that Drafts.
mux.HandleFunc("GET /inbox", func(w http.ResponseWriter, r *http.Request) {
redirect(w, r, "/posts", r.URL.Query().Get("msg"))
})
mux.HandleFunc("GET /drafts", func(w http.ResponseWriter, r *http.Request) {
redirect(w, r, "/inbox", r.URL.Query().Get("msg"))
redirect(w, r, "/posts", r.URL.Query().Get("msg"))
})
mux.HandleFunc("POST /drafts/{id}/{action}", s.draftAction)
mux.HandleFunc("POST /reddit/rules/{name}", s.refreshRules)
@@ -247,7 +251,7 @@ func (s *Server) loadTemplates() error {
// page is what every template gets.
type page struct {
Title string
Nav string // which menu item is current: "home", "content/inbox", "settings/ai"…
Nav string // which menu item is current: "home", "content/posts", "settings/ai"…
Version string
Flash string
Error string
@@ -337,7 +341,7 @@ var flashes = map[string]string{
"discarded": "Discarded.",
"scheduled": "Scheduled.",
"posted": "Marked as posted: it's under Content → Published.",
"unscheduled": "Back in the Inbox: edit it, then publish or schedule it again.",
"unscheduled": "Back in Posts: edit it, then publish or schedule it again.",
}
func redirect(w http.ResponseWriter, r *http.Request, path, msg string) {