@rmdes/indiekit-endpoint-webmention-io 1.0.0 → 1.0.1

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.
@@ -18,7 +18,13 @@ export const blocklistController = {
18
18
 
19
19
  if (db) {
20
20
  const collection = db.collection("webmentionBlocklist");
21
- entries = await getBlocklist(collection);
21
+ const raw = await getBlocklist(collection);
22
+ entries = raw.map((entry) => ({
23
+ ...entry,
24
+ blockedAt: entry.blockedAt instanceof Date
25
+ ? entry.blockedAt.toISOString()
26
+ : entry.blockedAt,
27
+ }));
22
28
  }
23
29
 
24
30
  response.render("webmentions-blocklist", {
@@ -15,6 +15,17 @@ import { blockDomain } from "../storage/blocklist.js";
15
15
  import { getSyncState } from "../sync.js";
16
16
  import { getMentionType, getMentionTitle, getAuthorName } from "../utils.js";
17
17
 
18
+ /**
19
+ * Convert Date objects to ISO strings for Nunjucks date filter
20
+ * @param {*} value
21
+ * @returns {string|undefined}
22
+ */
23
+ function toDateString(value) {
24
+ if (!value) return undefined;
25
+ if (value instanceof Date) return value.toISOString();
26
+ return String(value);
27
+ }
28
+
18
29
  export const dashboardController = {
19
30
  /**
20
31
  * GET / - Webmentions dashboard
@@ -29,7 +40,10 @@ export const dashboardController = {
29
40
  title: response.locals.__("webmention-io.title"),
30
41
  webmentions: [],
31
42
  counts: { total: 0, hidden: 0, visible: 0 },
32
- syncState: getSyncState(),
43
+ syncState: {
44
+ ...getSyncState(),
45
+ lastSync: toDateString(getSyncState().lastSync),
46
+ },
33
47
  cursor: {},
34
48
  filter: "all",
35
49
  typeFilter: "all",
@@ -82,7 +96,7 @@ export const dashboardController = {
82
96
  locale: application.locale,
83
97
  title: getMentionTitle({ name: item.name, "wm-property": item.wmProperty }),
84
98
  description: html ? { html } : undefined,
85
- published: item.published || item.wmReceived,
99
+ published: toDateString(item.published || item.wmReceived),
86
100
  url: item.sourceUrl,
87
101
  user: {
88
102
  avatar: { src: item.authorPhoto },
@@ -111,7 +125,10 @@ export const dashboardController = {
111
125
  title: response.locals.__("webmention-io.title"),
112
126
  webmentions,
113
127
  counts,
114
- syncState: getSyncState(),
128
+ syncState: {
129
+ ...getSyncState(),
130
+ lastSync: toDateString(getSyncState().lastSync),
131
+ },
115
132
  cursor,
116
133
  filter,
117
134
  typeFilter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-webmention-io",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
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",