@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
|
|
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
|
-
|
|
132
|
+
bio,
|
|
133
133
|
icon,
|
|
134
134
|
image,
|
|
135
135
|
instanceHost,
|
package/lib/inbox-listeners.js
CHANGED
|
@@ -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
|
-
|
|
369
|
-
|
|
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
|
|
503
|
+
if (object && (object instanceof Note || object instanceof Article)) {
|
|
509
504
|
const objectUrl = object.id?.href || "";
|
|
510
505
|
if (objectUrl) {
|
|
511
506
|
try {
|
package/lib/timeline-store.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
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
|
-
|
|
211
|
+
const mediaType = att.mediaType?.toLowerCase() || "";
|
|
205
212
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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.
|
|
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.
|
|
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
|
|
61
|
-
<div class="ap-profile__bio">{{
|
|
60
|
+
{% if bio %}
|
|
61
|
+
<div class="ap-profile__bio">{{ bio | safe }}</div>
|
|
62
62
|
{% endif %}
|
|
63
63
|
</div>
|
|
64
64
|
|