@chrisburnell/eleventy-cache-webmentions 2.1.4 → 2.1.6

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.
@@ -0,0 +1 @@
1
+ [{"68a403136c61abd104ade94e69ba62":"1"},{"cachedAt":1723578147488,"type":"2"},"json"]
@@ -0,0 +1 @@
1
+ [{"type":"entry","author":{"type":"card","name":"Jane Doe","url":"https://example.com"},"url":"https://example.com/post1/","published":"2024-01-01T12:00:00Z","wm-received":"2024-01-01T12:00:00Z","wm-id":123456,"wm-source":"https://example.com/post1/","wm-target":"https://example.com/page1/","wm-protocol":"webmention","name":"Example Post","content":{"content-type":"text/html","value":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>","html":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>","text":"Lorem ipsum dolor sit amet, consectetur adipiscing elit."},"mention-of":"https://example.com/page1/","wm-property":"mention-of","wm-private":false},{"type":"entry","author":{"type":"card","name":"Jane Doe","url":"https://example.com"},"url":"https://example.com/post2/","published":"2024-01-01T12:00:00Z","wm-received":"2024-01-01T12:00:00Z","wm-id":234567,"wm-source":"https://example.com/post2/","wm-target":"https://example.com/page2/","wm-protocol":"webmention","name":"Example Post","content":{"content-type":"text/html","value":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>","html":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>","text":"Lorem ipsum dolor sit amet, consectetur adipiscing elit."},"in-reply-to":"https://example.com/page2/","wm-property":"in-reply-to","wm-private":false},{"type":"entry","author":{"type":"card","name":"Jane Doe","url":"https://example.com"},"url":"https://example.com/post3/","published":"2024-01-01T12:00:00Z","wm-received":"2024-01-01T12:00:00Z","wm-id":345678,"wm-source":"https://example.com/post3/","wm-target":"https://example.com/page2/","wm-protocol":"webmention","name":"Example Post","content":{"content-type":"text/html","value":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>","html":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>","text":"Lorem ipsum dolor sit amet, consectetur adipiscing elit."},"mention-of":"https://example.com/page2/","wm-property":"mention-of","wm-private":false}]
@@ -162,9 +162,13 @@ const performFetch = async (options, webmentions, url) => {
162
162
  // Process the blocklist, if it has any entries
163
163
  if (options.blocklist.length) {
164
164
  webmentions = webmentions.filter((webmention) => {
165
- let sourceUrl = getSource(webmention);
166
- for (let url of options.blocklist) {
167
- if (sourceUrl.includes(url.replace(/\/?$/, "/"))) {
165
+ let url = getSource(webmention);
166
+ let source = getSource(webmention);
167
+ for (let blocklistURL of options.blocklist) {
168
+ if (
169
+ url.includes(blocklistURL.replace(/\/?$/, "/")) ||
170
+ source.includes(blocklistURL.replace(/\/?$/, "/"))
171
+ ) {
168
172
  return false;
169
173
  }
170
174
  }
@@ -174,9 +178,13 @@ const performFetch = async (options, webmentions, url) => {
174
178
  // Process the allowlist, if it has any entries
175
179
  if (options.allowlist.length) {
176
180
  webmentions = webmentions.filter((webmention) => {
177
- let sourceUrl = getSource(webmention);
178
- for (let url of options.allowlist) {
179
- if (sourceUrl.includes(url.replace(/\/?$/, "/"))) {
181
+ let url = getSource(webmention);
182
+ let source = getSource(webmention);
183
+ for (let allowlistURL of options.allowlist) {
184
+ if (
185
+ url.includes(allowlistURL.replace(/\/?$/, "/")) ||
186
+ source.includes(allowlistURL.replace(/\/?$/, "/"))
187
+ ) {
180
188
  return true;
181
189
  }
182
190
  }
@@ -429,6 +437,7 @@ module.exports.defaults = defaults;
429
437
  module.exports.filteredWebmentions = filteredWebmentions;
430
438
  module.exports.webmentionsByUrl = filteredWebmentions;
431
439
  module.exports.fetchWebmentions = fetchWebmentions;
440
+ module.exports.performFetch = performFetch;
432
441
  module.exports.getWebmentions = getWebmentions;
433
442
  module.exports.getByType = getByType;
434
443
  module.exports.getWebmentionsByType = getByType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisburnell/eleventy-cache-webmentions",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "Cache webmentions using eleventy-fetch and make them available to use in collections, layouts, pages, etc. in Eleventy.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,7 +39,8 @@
39
39
  },
40
40
  "main": "eleventy-cache-webmentions.js",
41
41
  "scripts": {
42
- "lint": "eslint eleventy-cache-webmentions.js"
42
+ "lint": "eslint eleventy-cache-webmentions.js",
43
+ "test": "node --test"
43
44
  },
44
45
  "keywords": [
45
46
  "eleventy",
@@ -56,6 +57,7 @@
56
57
  "sanitize-html": "^2.13.0"
57
58
  },
58
59
  "devDependencies": {
59
- "eslint": "^9.8.0"
60
+ "eslint": "^9.8.0",
61
+ "nock": "^13.5.4"
60
62
  }
61
63
  }