New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webmention-handler

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webmention-handler - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

package.json
{
"name": "webmention-handler",
"version": "0.0.3",
"version": "0.0.4",
"description": "A handler for web mentions",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -87,11 +87,14 @@ import { convertHEntryToMention } from "../functions/convert-h-entry-to-mention";

const {html, status, error} = await fetchHtml(mention.source);
// Delete exisiting webmentions with the current source and target to avoid duplication
await this.storageHandler.deleteMention(mention);
// A status of 410 indicates that the webmention that previously existed was deleted
// If we got an error or there was no html body, then the source is invalid and
// we should delete any stored version of the webmention as per the specification
if(error || !html || status === 410) return this.storageHandler.deleteMention(mention);
// we should delete any stored version of the webmention as per the specification without
// adding new ones
if(error || !html || status === 410) return null;
const hEntries = parseHtml(html, mention.source, mention.target);
let mentionedUrls = hEntries.find(({type}) => type && type.includes("mention-of"));
// If the page does not include any mention of the target, then delete any previously
// acknowledged mentions and retun null;
if(!mentionedUrls) return this.storageHandler.deleteMention(mention);
// If the page does not include any mention of the target, then we can return
// early as we have already deleted any stored mentions with this target and source
if(!mentionedUrls) return null;

@@ -98,0 +101,0 @@ let mentions = hEntries.map(h => convertHEntryToMention(h, mention.source, mention.target));

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc