@rmdes/indiekit-endpoint-activitypub 1.1.11 → 1.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,7 +64,7 @@ export function remoteProfileController(mountPath, plugin) {
64
64
  actor.preferredUsername?.toString() ||
65
65
  actorUrl;
66
66
  const actorHandle = actor.preferredUsername?.toString() || "";
67
- const summary = sanitizeContent(actor.summary?.toString() || "");
67
+ const bio = sanitizeContent(actor.summary?.toString() || "");
68
68
  let icon = "";
69
69
  let image = "";
70
70
 
@@ -129,7 +129,7 @@ export function remoteProfileController(mountPath, plugin) {
129
129
  actorUrl,
130
130
  name,
131
131
  actorHandle,
132
- summary,
132
+ bio,
133
133
  icon,
134
134
  image,
135
135
  instanceHost,
@@ -9,6 +9,7 @@ import {
9
9
  Accept,
10
10
  Add,
11
11
  Announce,
12
+ Article,
12
13
  Block,
13
14
  Create,
14
15
  Delete,
@@ -365,14 +366,8 @@ export function registerInboxListeners(inboxChain, options) {
365
366
  actorObj?.preferredUsername?.toString() ||
366
367
  actorUrl;
367
368
 
368
- let inReplyTo = null;
369
- if (object instanceof Note && typeof object.getInReplyTo === "function") {
370
- try {
371
- inReplyTo = (await object.getInReplyTo())?.id?.href ?? null;
372
- } catch {
373
- /* remote fetch may fail */
374
- }
375
- }
369
+ // Use replyTargetId (non-fetching) for the inReplyTo URL
370
+ const inReplyTo = object.replyTargetId?.href || null;
376
371
 
377
372
  // Log replies to our posts (existing behavior for conversations)
378
373
  const pubUrl = collections._publicationUrl;
@@ -505,7 +500,7 @@ export function registerInboxListeners(inboxChain, options) {
505
500
  }
506
501
 
507
502
  // PATH 1: If object is a Note/Article → Update timeline item content
508
- if (object && (object instanceof Note || object.type === "Article")) {
503
+ if (object && (object instanceof Note || object instanceof Article)) {
509
504
  const objectUrl = object.id?.href || "";
510
505
  if (objectUrl) {
511
506
  try {
@@ -3,6 +3,7 @@
3
3
  * @module timeline-store
4
4
  */
5
5
 
6
+ import { Article } from "@fedify/fedify";
6
7
  import sanitizeHtml from "sanitize-html";
7
8
 
8
9
  /**
@@ -98,9 +99,9 @@ export async function extractObjectData(object, options = {}) {
98
99
  const uid = object.id?.href || "";
99
100
  const url = object.url?.href || uid;
100
101
 
101
- // Determine type
102
+ // Determine type — use instanceof for Fedify vocab objects
102
103
  let type = "note";
103
- if (object.type?.toLowerCase() === "article") {
104
+ if (object instanceof Article) {
104
105
  type = "article";
105
106
  }
106
107
  if (options.boostedBy) {
@@ -179,42 +180,51 @@ export async function extractObjectData(object, options = {}) {
179
180
  }
180
181
  }
181
182
 
182
- // Extract tags/categories
183
+ // Extract tags/categories — Fedify uses async getTags()
183
184
  const category = [];
184
- if (object.tag) {
185
- const tags = Array.isArray(object.tag) ? object.tag : [object.tag];
186
- for (const tag of tags) {
187
- if (tag.type === "Hashtag" && tag.name) {
188
- category.push(tag.name.toString().replace(/^#/, ""));
185
+ try {
186
+ if (typeof object.getTags === "function") {
187
+ const tags = await object.getTags();
188
+ for (const tag of tags) {
189
+ if (tag.name) {
190
+ const tagName = tag.name.toString().replace(/^#/, "");
191
+ if (tagName) category.push(tagName);
192
+ }
189
193
  }
190
194
  }
195
+ } catch {
196
+ // Tags extraction failed — non-critical
191
197
  }
192
198
 
193
- // Extract media attachments
199
+ // Extract media attachments — Fedify uses async getAttachments()
194
200
  const photo = [];
195
201
  const video = [];
196
202
  const audio = [];
197
203
 
198
- if (object.attachment) {
199
- const attachments = Array.isArray(object.attachment) ? object.attachment : [object.attachment];
200
- for (const att of attachments) {
201
- const mediaUrl = att.url?.href || "";
202
- if (!mediaUrl) continue;
204
+ try {
205
+ if (typeof object.getAttachments === "function") {
206
+ const attachments = await object.getAttachments();
207
+ for (const att of attachments) {
208
+ const mediaUrl = att.url?.href || "";
209
+ if (!mediaUrl) continue;
203
210
 
204
- const mediaType = att.mediaType?.toLowerCase() || "";
211
+ const mediaType = att.mediaType?.toLowerCase() || "";
205
212
 
206
- if (mediaType.startsWith("image/")) {
207
- photo.push(mediaUrl);
208
- } else if (mediaType.startsWith("video/")) {
209
- video.push(mediaUrl);
210
- } else if (mediaType.startsWith("audio/")) {
211
- audio.push(mediaUrl);
213
+ if (mediaType.startsWith("image/")) {
214
+ photo.push(mediaUrl);
215
+ } else if (mediaType.startsWith("video/")) {
216
+ video.push(mediaUrl);
217
+ } else if (mediaType.startsWith("audio/")) {
218
+ audio.push(mediaUrl);
219
+ }
212
220
  }
213
221
  }
222
+ } catch {
223
+ // Attachment extraction failed — non-critical
214
224
  }
215
225
 
216
- // In-reply-to
217
- const inReplyTo = object.inReplyTo?.href || "";
226
+ // In-reply-to — Fedify uses replyTargetId (non-fetching)
227
+ const inReplyTo = object.replyTargetId?.href || "";
218
228
 
219
229
  // Build base timeline item
220
230
  const item = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -57,8 +57,8 @@
57
57
  {% if actorHandle %}
58
58
  <div class="ap-profile__handle">@{{ actorHandle }}@{{ instanceHost }}</div>
59
59
  {% endif %}
60
- {% if summary %}
61
- <div class="ap-profile__bio">{{ summary | safe }}</div>
60
+ {% if bio %}
61
+ <div class="ap-profile__bio">{{ bio | safe }}</div>
62
62
  {% endif %}
63
63
  </div>
64
64