@rmdes/indiekit-endpoint-activitypub 3.6.4 → 3.6.5

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.
@@ -60,7 +60,42 @@ export async function resolveRemoteAccount(acct, pluginOptions, baseUrl) {
60
60
  headerUrl = image?.url?.href || "";
61
61
  } catch { /* ignore */ }
62
62
 
63
- return serializeAccount(
63
+ // Get collection counts (followers, following, outbox)
64
+ let followersCount = 0;
65
+ let followingCount = 0;
66
+ let statusesCount = 0;
67
+ try {
68
+ const followers = await actor.getFollowers();
69
+ if (followers?.totalItems != null) followersCount = followers.totalItems;
70
+ } catch { /* ignore */ }
71
+ try {
72
+ const following = await actor.getFollowing();
73
+ if (following?.totalItems != null) followingCount = following.totalItems;
74
+ } catch { /* ignore */ }
75
+ try {
76
+ const outbox = await actor.getOutbox();
77
+ if (outbox?.totalItems != null) statusesCount = outbox.totalItems;
78
+ } catch { /* ignore */ }
79
+
80
+ // Get published/created date
81
+ const published = actor.published
82
+ ? String(actor.published)
83
+ : null;
84
+
85
+ // Profile fields from attachments
86
+ const fields = [];
87
+ try {
88
+ for await (const attachment of actor.getAttachments()) {
89
+ if (attachment?.name) {
90
+ fields.push({
91
+ name: attachment.name?.toString() || "",
92
+ value: attachment.value?.toString() || "",
93
+ });
94
+ }
95
+ }
96
+ } catch { /* ignore */ }
97
+
98
+ const account = serializeAccount(
64
99
  {
65
100
  name,
66
101
  url: actorUrl,
@@ -69,9 +104,18 @@ export async function resolveRemoteAccount(acct, pluginOptions, baseUrl) {
69
104
  summary,
70
105
  image: headerUrl,
71
106
  bot: actor.constructor?.name === "Service" || actor.constructor?.name === "Application",
107
+ attachments: fields.length > 0 ? fields : undefined,
108
+ createdAt: published || undefined,
72
109
  },
73
110
  { baseUrl },
74
111
  );
112
+
113
+ // Override counts with real data from AP collections
114
+ account.followers_count = followersCount;
115
+ account.following_count = followingCount;
116
+ account.statuses_count = statusesCount;
117
+
118
+ return account;
75
119
  } catch (error) {
76
120
  console.warn(`[Mastodon API] Remote account resolution failed for ${acct}:`, error.message);
77
121
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "3.6.4",
3
+ "version": "3.6.5",
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",