@rmdes/indiekit-endpoint-webmention-io 1.0.7 → 1.0.9

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.
Files changed (3) hide show
  1. package/index.js +11 -1
  2. package/lib/blocks.js +35 -0
  3. package/package.json +2 -1
package/index.js CHANGED
@@ -7,6 +7,8 @@ import { blocklistController } from "./lib/controllers/blocklist.js";
7
7
  import { syncController } from "./lib/controllers/sync-controller.js";
8
8
  import { apiController } from "./lib/controllers/api.js";
9
9
  import { startSync, stopSync } from "./lib/sync.js";
10
+ import { waitForReady } from "@rmdes/indiekit-startup-gate";
11
+ import { WEBMENTION_BLOCKS } from "./lib/blocks.js";
10
12
 
11
13
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
14
 
@@ -43,6 +45,10 @@ export default class WebmentionEndpoint {
43
45
  };
44
46
  }
45
47
 
48
+ get blocks() {
49
+ return WEBMENTION_BLOCKS;
50
+ }
51
+
46
52
  /**
47
53
  * Protected routes (require authentication)
48
54
  * Admin dashboard, moderation, sync controls
@@ -103,11 +109,15 @@ export default class WebmentionEndpoint {
103
109
 
104
110
  // Start background sync if database is available
105
111
  if (Indiekit.config.application.mongodbUrl) {
106
- startSync(Indiekit, this.options);
112
+ this._stopGate = waitForReady(
113
+ () => startSync(Indiekit, this.options),
114
+ { label: "Webmention.io" },
115
+ );
107
116
  }
108
117
  }
109
118
 
110
119
  destroy() {
120
+ this._stopGate?.();
111
121
  stopSync();
112
122
  }
113
123
  }
package/lib/blocks.js ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Webmention-io v2 block declaration (Phase 7b — plugin block ownership).
3
+ *
4
+ * The `webmentions` sidebar widget was a site-config BUILTIN_BLOCKS seed
5
+ * (requiresPlugin null, gated only by the theme's legacy widgetPluginRequirements
6
+ * render-map). Declaring it here makes site-config's scanPlugins stamp
7
+ * `sourcePlugin` → `requiresPlugin` ("Webmention moderation endpoint"), so the
8
+ * block is properly plugin-gated (theme ENDPOINT_SLUGS maps it to the
9
+ * `webmention-io` loadout slug). scanPlugins precedence is `built-in < plugin
10
+ * blocks`, so this entry OVERWRITES the builtin seed on sites where the plugin is
11
+ * loaded; the seed itself is removed from site-config in Phase 7d alongside the
12
+ * legacy-map bridge.
13
+ *
14
+ * Descriptor is byte-faithful to the BUILTIN_BLOCKS entry. Bespoke template: the
15
+ * theme owns `components/widgets/webmentions.njk` (no generic `render.renderer`);
16
+ * `data.source:"api"` documents the runtime fetch.
17
+ *
18
+ * @module lib/blocks
19
+ */
20
+
21
+ /** @type {Array<object>} */
22
+ export const WEBMENTION_BLOCKS = [
23
+ {
24
+ id: "webmentions",
25
+ version: 1,
26
+ label: "Webmentions",
27
+ description: "Recent inbound/outbound webmentions",
28
+ icon: "message-circle",
29
+ category: "social",
30
+ placement: { regions: ["sidebar"], surfaces: ["homepage", "postType"] },
31
+ multiple: false,
32
+ data: { source: "api" },
33
+ schema: { type: "object", additionalProperties: false, properties: {} },
34
+ },
35
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-webmention-io",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Webmention moderation endpoint for Indiekit. Syncs webmentions from webmention.io into MongoDB with delete, block, and privacy removal capabilities.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -37,6 +37,7 @@
37
37
  "index.js"
38
38
  ],
39
39
  "dependencies": {
40
+ "@rmdes/indiekit-startup-gate": "^1.0.0",
40
41
  "@indiekit/error": "^1.0.0-beta.25",
41
42
  "@indiekit/frontend": "^1.0.0-beta.25",
42
43
  "express": "^5.0.0",