@rmdes/indiekit-endpoint-activitypub 1.1.6 → 1.1.8
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.
- package/lib/controllers/profile.js +9 -3
- package/lib/timeline-store.js +13 -4
- package/package.json +1 -1
|
@@ -50,9 +50,15 @@ export function profilePostController(mountPath, plugin) {
|
|
|
50
50
|
authorizedFetch,
|
|
51
51
|
} = request.body;
|
|
52
52
|
|
|
53
|
-
// Parse profile links (attachments) from form arrays
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
// Parse profile links (attachments) from form arrays.
|
|
54
|
+
// With express.urlencoded({ extended: true }), qs strips the []
|
|
55
|
+
// suffix so the data arrives as request.body.link_name (array).
|
|
56
|
+
const linkNames = [].concat(
|
|
57
|
+
request.body.link_name || request.body["link_name[]"] || [],
|
|
58
|
+
);
|
|
59
|
+
const linkValues = [].concat(
|
|
60
|
+
request.body.link_value || request.body["link_value[]"] || [],
|
|
61
|
+
);
|
|
56
62
|
const attachments = [];
|
|
57
63
|
for (let i = 0; i < linkNames.length; i++) {
|
|
58
64
|
const n = linkNames[i]?.trim();
|
package/lib/timeline-store.js
CHANGED
|
@@ -155,10 +155,19 @@ export async function extractObjectData(object, options = {}) {
|
|
|
155
155
|
const attrIds = object.attributionIds;
|
|
156
156
|
if (attrIds && attrIds.length > 0) {
|
|
157
157
|
const authorUrl = attrIds[0].href;
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
const parsedUrl = new URL(authorUrl);
|
|
159
|
+
const authorHostname = parsedUrl.hostname;
|
|
160
|
+
// Extract username from common URL patterns:
|
|
161
|
+
// /@username, /users/username, /ap/users/12345/
|
|
162
|
+
const pathname = parsedUrl.pathname;
|
|
163
|
+
let username = "";
|
|
164
|
+
const atPattern = pathname.match(/\/@([^/]+)/);
|
|
165
|
+
const usersPattern = pathname.match(/\/users\/([^/]+)/);
|
|
166
|
+
if (atPattern) {
|
|
167
|
+
username = atPattern[1];
|
|
168
|
+
} else if (usersPattern) {
|
|
169
|
+
username = usersPattern[1];
|
|
170
|
+
}
|
|
162
171
|
author = {
|
|
163
172
|
name: username || authorHostname,
|
|
164
173
|
url: authorUrl,
|
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.8",
|
|
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",
|