@rmdes/indiekit-endpoint-activitypub 1.0.6 → 1.0.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.
@@ -16,6 +16,7 @@ import {
16
16
  createFederation,
17
17
  importSpki,
18
18
  } from "@fedify/fedify";
19
+ import { configure, getConsoleSink, getLogger } from "@logtape/logtape";
19
20
  import { MongoKvStore } from "./kv-store.js";
20
21
  import { registerInboxListeners } from "./inbox-listeners.js";
21
22
 
@@ -29,6 +30,9 @@ import { registerInboxListeners } from "./inbox-listeners.js";
29
30
  * @param {boolean} options.storeRawActivities - Whether to store full raw JSON
30
31
  * @returns {{ federation: import("@fedify/fedify").Federation }}
31
32
  */
33
+ // Track whether LogTape has been configured (can only call configure() once)
34
+ let _logtapeConfigured = false;
35
+
32
36
  export function setupFederation(options) {
33
37
  const {
34
38
  collections,
@@ -37,6 +41,26 @@ export function setupFederation(options) {
37
41
  storeRawActivities = false,
38
42
  } = options;
39
43
 
44
+ // Configure LogTape for Fedify delivery logging (once per process)
45
+ if (!_logtapeConfigured) {
46
+ _logtapeConfigured = true;
47
+ configure({
48
+ sinks: {
49
+ console: getConsoleSink(),
50
+ },
51
+ loggers: [
52
+ {
53
+ // All Fedify logs — federation, vocab, delivery, HTTP signatures
54
+ category: ["fedify"],
55
+ sinks: ["console"],
56
+ lowestLevel: "info",
57
+ },
58
+ ],
59
+ }).catch((error) => {
60
+ console.warn("[ActivityPub] LogTape configure failed:", error.message);
61
+ });
62
+ }
63
+
40
64
  const federation = createFederation({
41
65
  kv: new MongoKvStore(collections.ap_kv),
42
66
  queue: new InProcessMessageQueue(),
@@ -138,6 +162,13 @@ export function setupFederation(options) {
138
162
  storeRawActivities,
139
163
  });
140
164
 
165
+ // Enable authenticated fetches for the shared inbox.
166
+ // Without this, Fedify can't verify incoming HTTP Signatures from servers
167
+ // that require authorized fetch (e.g. hachyderm.io returns 401 on unsigned GETs).
168
+ // This tells Fedify to use our actor's key pair when fetching remote actor
169
+ // documents during signature verification on the shared inbox.
170
+ inboxChain.setSharedKeyDispatcher((_ctx) => ({ identifier: handle }));
171
+
141
172
  // --- Collection dispatchers ---
142
173
  setupFollowers(federation, mountPath, handle, collections);
143
174
  setupFollowing(federation, mountPath, handle, collections);
@@ -163,6 +194,14 @@ export function setupFederation(options) {
163
194
  };
164
195
  });
165
196
 
197
+ // Start the message queue for outbound activity delivery.
198
+ // Without this, ctx.sendActivity() enqueues delivery tasks but the
199
+ // InProcessMessageQueue never processes them — activities are never
200
+ // actually POSTed to follower inboxes.
201
+ federation.startQueue().catch((error) => {
202
+ console.error("[ActivityPub] Failed to start delivery queue:", error.message);
203
+ });
204
+
166
205
  return { federation };
167
206
  }
168
207
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "1.0.6",
3
+ "version": "1.0.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",