docs: document likes-as-bookmarks, OG images, and announce revert

- Update README: likes delivered as bookmarks, announces use upstream
  addressing, OG images added to AP objects
- Update fork reference to 45f8ba9
- Remove unused patch-ap-like-announce-addressing.mjs (now in fork)
- Update package-lock.json for new fork commit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sven
2026-03-19 01:39:08 +01:00
parent 7419e37832
commit 8e304e4fc1
3 changed files with 9 additions and 178 deletions
+8 -4
View File
@@ -12,14 +12,14 @@ Four packages are installed directly from GitHub forks rather than the npm regis
| Dependency | Source | Reason |
|---|---|---|
| `@rmdes/indiekit-endpoint-activitypub` | [svemagie/indiekit-endpoint-activitypub](https://github.com/svemagie/indiekit-endpoint-activitypub) | DM support, Like/Announce addressing, draft/unlisted outbox guards, merged with upstream v2.15.4 |
| `@rmdes/indiekit-endpoint-activitypub` | [svemagie/indiekit-endpoint-activitypub](https://github.com/svemagie/indiekit-endpoint-activitypub) | DM support, likes-as-bookmarks, OG images in AP objects, draft/unlisted outbox guards, merged with upstream v2.15.4 |
| `@rmdes/indiekit-endpoint-blogroll` | [svemagie/indiekit-endpoint-blogroll#bookmark-import](https://github.com/svemagie/indiekit-endpoint-blogroll/tree/bookmark-import) | Bookmark import feature |
| `@rmdes/indiekit-endpoint-microsub` | [svemagie/indiekit-endpoint-microsub#bookmarks-import](https://github.com/svemagie/indiekit-endpoint-microsub/tree/bookmarks-import) | Bookmarks import feature |
| `@rmdes/indiekit-endpoint-youtube` | [svemagie/indiekit-endpoint-youtube](https://github.com/svemagie/indiekit-endpoint-youtube) | OAuth 2.0 liked-videos sync as "like" posts |
In `package.json` these use the `github:owner/repo[#branch]` syntax so npm fetches them directly from GitHub on install.
> **Lockfile caveat:** The fork dependency is resolved to a specific commit in `package-lock.json`. When fixes are pushed to the fork, run `npm update @rmdes/indiekit-endpoint-activitypub` to pull the latest commit. The fork HEAD is at `b99f5fb` (merged upstream v2.13.0v2.15.4 with DM support, Like/Announce addressing, and draft/unlisted guards).
> **Lockfile caveat:** The fork dependency is resolved to a specific commit in `package-lock.json`. When fixes are pushed to the fork, run `npm update @rmdes/indiekit-endpoint-activitypub` to pull the latest commit. The fork HEAD is at `45f8ba9` (merged upstream v2.13.0v2.15.4 with DM support, likes-as-bookmarks, OG images in AP objects, and draft/unlisted guards).
---
@@ -130,8 +130,8 @@ Posts are converted from Indiekit's JF2 format to ActivityStreams 2.0 in two mod
|---|---|---|---|
| note | Create | Note | Plain text/HTML content |
| article | Create | Article | Has `name` (title) and optional `summary` |
| like | Like | URL | `to: Public, cc: followers` (baked into fork); outbox serves as Note for Mastodon compat |
| repost | Announce | URL | `to: Public, cc: followers` (baked into fork); outbox serves as Note for Mastodon compat |
| like | Create | Note | Delivered as bookmark (🔖 emoji + URL, `#bookmark` tag); same as bookmark handling |
| repost | Announce | URL | `to: Public` (upstream @rmdes addressing); content negotiation serves as Note |
| bookmark | Create | Note | Content prefixed with bookmark emoji + URL |
| reply | Create | Note | `inReplyTo` set, author CC'd and Mentioned |
@@ -148,6 +148,7 @@ Posts are converted from Indiekit's JF2 format to ActivityStreams 2.0 in two mod
- Permalink appended to content body
- Nested hashtags normalized: `on/art/music``#music` (Mastodon doesn't support path-style tags)
- Sensitive posts flagged with `sensitive: true`; summary doubles as CW text for notes
- Per-post OG image added to Note/Article objects (`/og/{year}-{month}-{day}-{slug}.png`) for fediverse preview cards
### Express ↔ Fedify bridge
@@ -646,6 +647,9 @@ Environment variables are loaded from `.env` via `dotenv`. See `indiekit.config.
### 2026-03-19
**feat: deliver likes as bookmarks, revert announce cc, add OG images** (`45f8ba9` in svemagie/indiekit-endpoint-activitypub)
Likes are now sent as Create/Note with bookmark-style content (🔖 emoji + URL + `#bookmark` tag) instead of Like activities — ensures proper display on Mastodon. Announce activities reverted to upstream @rmdes addressing (`to: Public` only, no `cc: followers`). Both plain JSON-LD and Fedify Note/Article objects now include a per-post OG image derived from the post URL pattern. Removed unused `patch-ap-like-announce-addressing.mjs`.
**feat: add soft-delete filter and content-warning support to blog theme** (`d9ac9bf` in svemagie/blog)
Posts with `deleted: true` are now excluded from all Eleventy collections (supports AP soft-delete). Posts with `contentWarning`/`content_warning` frontmatter show a collapsible warning on post pages and a warning label (hiding content + photos) on listing pages.
+1 -1
View File
@@ -2357,7 +2357,7 @@
},
"node_modules/@rmdes/indiekit-endpoint-activitypub": {
"version": "2.15.4",
"resolved": "git+ssh://git@github.com/svemagie/indiekit-endpoint-activitypub.git#b99f5fb73eb23e82f28d642aeb0ba7c665903219",
"resolved": "git+ssh://git@github.com/svemagie/indiekit-endpoint-activitypub.git#45f8ba93c0202fabf460bdd03e9ee758faa0a457",
"license": "MIT",
"dependencies": {
"@fedify/debugger": "^2.0.0",
@@ -1,173 +0,0 @@
/**
* Patch: add proper to/cc addressing to Like and Announce activities.
*
* Root cause:
* jf2ToAS2Activity() builds Like and Announce activities without adding
* the followers collection to `cc`. Mastodon's shared inbox uses `to`/`cc`
* to route activities to local followers without `cc: followers`, the
* activities are accepted (HTTP 202) but silently dropped.
*
* Fix:
* Add `to: Public, cc: followers` to Like activities and
* `cc: followers` to Announce activities, matching the addressing
* already used for Create/Note activities.
*/
import { access, readFile, writeFile } from "node:fs/promises";
const candidates = [
"node_modules/@rmdes/indiekit-endpoint-activitypub/lib/jf2-to-as2.js",
"node_modules/@indiekit/indiekit/node_modules/@rmdes/indiekit-endpoint-activitypub/lib/jf2-to-as2.js",
];
const MARKER = "// like/announce addressing fix";
// --- Like: plain JSON-LD (jf2ToActivityStreams) ---
const OLD_LIKE_PLAIN = ` if (postType === "like") {
// Serve like posts as Note objects for AP content negotiation.
// Returning a bare Like activity breaks Mastodon's authorize_interaction
// flow because it expects a content object (Note/Article), not an activity.
const likeOf = properties["like-of"];
const postUrl = resolvePostUrl(properties.url, publicationUrl);
return {
"@context": "https://www.w3.org/ns/activitystreams",
type: "Note",
id: postUrl,
attributedTo: actorUrl,
published: properties.published,
url: postUrl,
to: ["https://www.w3.org/ns/activitystreams#Public"],
cc: [\`\${actorUrl.replace(/\\/$/, "")}/followers\`],
content: \`\\u2764\\uFE0F <a href="\${likeOf}">\${likeOf}</a>\`,
};
}`;
// Plain JSON-LD like is already correctly addressed (to: Public, cc: followers)
// so we only need the marker. We skip patching if the marker is present.
// --- Repost: plain JSON-LD (jf2ToActivityStreams) ---
const OLD_REPOST_PLAIN = ` if (postType === "repost") {
// Same rationale as like — serve as Note for content negotiation.
const repostOf = properties["repost-of"];
const postUrl = resolvePostUrl(properties.url, publicationUrl);
return {
"@context": "https://www.w3.org/ns/activitystreams",
type: "Note",
id: postUrl,
attributedTo: actorUrl,
published: properties.published,
url: postUrl,
to: ["https://www.w3.org/ns/activitystreams#Public"],
cc: [\`\${actorUrl.replace(/\\/$/, "")}/followers\`],
content: \`\\u{1F501} <a href="\${repostOf}">\${repostOf}</a>\`,
};
}`;
// Plain JSON-LD repost is already correctly addressed too.
// --- Like: Fedify vocab (jf2ToAS2Activity) ---
const OLD_LIKE_FEDIFY = ` if (postType === "like") {
const likeOf = properties["like-of"];
if (!likeOf) return null;
return new Like({
actor: actorUri,
object: new URL(likeOf),
});
}`;
const NEW_LIKE_FEDIFY = ` if (postType === "like") {
const likeOf = properties["like-of"];
if (!likeOf) return null;
const followersUrl = \`\${actorUrl.replace(/\\/$/, "")}/followers\`; // like/announce addressing fix
return new Like({
actor: actorUri,
object: new URL(likeOf),
to: new URL("https://www.w3.org/ns/activitystreams#Public"),
cc: new URL(followersUrl),
});
}`;
// --- Announce: Fedify vocab (jf2ToAS2Activity) ---
const OLD_ANNOUNCE_FEDIFY = ` if (postType === "repost") {
const repostOf = properties["repost-of"];
if (!repostOf) return null;
return new Announce({
actor: actorUri,
object: new URL(repostOf),
to: new URL("https://www.w3.org/ns/activitystreams#Public"),
});
}`;
const NEW_ANNOUNCE_FEDIFY = ` if (postType === "repost") {
const repostOf = properties["repost-of"];
if (!repostOf) return null;
const followersUrl = \`\${actorUrl.replace(/\\/$/, "")}/followers\`; // like/announce addressing fix
return new Announce({
actor: actorUri,
object: new URL(repostOf),
to: new URL("https://www.w3.org/ns/activitystreams#Public"),
cc: new URL(followersUrl),
});
}`;
async function exists(filePath) {
try {
await access(filePath);
return true;
} catch {
return false;
}
}
let checked = 0;
let patched = 0;
for (const filePath of candidates) {
if (!(await exists(filePath))) {
continue;
}
checked += 1;
let source = await readFile(filePath, "utf8");
if (source.includes(MARKER)) {
continue;
}
let updated = source;
let changed = false;
if (source.includes(OLD_LIKE_FEDIFY)) {
updated = updated.replace(OLD_LIKE_FEDIFY, NEW_LIKE_FEDIFY);
changed = true;
} else {
console.log(`[postinstall] patch-ap-like-announce-addressing: Like snippet not found in ${filePath}`);
}
if (source.includes(OLD_ANNOUNCE_FEDIFY)) {
updated = updated.replace(OLD_ANNOUNCE_FEDIFY, NEW_ANNOUNCE_FEDIFY);
changed = true;
} else {
console.log(`[postinstall] patch-ap-like-announce-addressing: Announce snippet not found in ${filePath}`);
}
if (!changed || updated === source) {
continue;
}
await writeFile(filePath, updated, "utf8");
patched += 1;
console.log(`[postinstall] Applied patch-ap-like-announce-addressing to ${filePath}`);
}
if (checked === 0) {
console.log("[postinstall] patch-ap-like-announce-addressing: no target files found");
} else if (patched === 0) {
console.log("[postinstall] patch-ap-like-announce-addressing: already up to date");
} else {
console.log(`[postinstall] patch-ap-like-announce-addressing: patched ${patched}/${checked} file(s)`);
}