@rmdes/indiekit-endpoint-activitypub 2.0.21 → 2.0.23

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.
@@ -721,6 +721,20 @@ export async function buildPersonActor(
721
721
  personOptions.assertionMethods = keyPairs.map((k) => k.multikey);
722
722
  }
723
723
 
724
+ // Build profile field attachments (PropertyValue).
725
+ // Always include a "Fediverse" field with the actor's handle — this serves
726
+ // two purposes: (1) shows the canonical fediverse address on the profile,
727
+ // and (2) ensures 2+ attachments when combined with user-defined fields,
728
+ // preventing Fedify's JSON-LD compaction from collapsing single-element
729
+ // arrays to plain objects (which Mastodon's update_account_fields rejects).
730
+ const actorUrl = ctx.getActorUri(identifier)?.href;
731
+ const fediverseField = actorUrl
732
+ ? new PropertyValue({
733
+ name: "Fediverse",
734
+ value: `<a href="${actorUrl}" rel="me">${actorUrl}</a>`,
735
+ })
736
+ : null;
737
+
724
738
  if (profile.attachments?.length > 0) {
725
739
  personOptions.attachments = profile.attachments.map(
726
740
  (att) =>
@@ -729,6 +743,12 @@ export async function buildPersonActor(
729
743
  value: formatAttachmentValue(att.value),
730
744
  }),
731
745
  );
746
+ // Append fediverse field if not already present in user-defined fields
747
+ if (fediverseField && !profile.attachments.some((a) => a.name === "Fediverse")) {
748
+ personOptions.attachments.push(fediverseField);
749
+ }
750
+ } else if (fediverseField) {
751
+ personOptions.attachments = [fediverseField];
732
752
  }
733
753
 
734
754
  if (profile.alsoKnownAs?.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "2.0.21",
3
+ "version": "2.0.23",
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",