Skip to content

A tool to ping your site with a variety of real world WebMentions

Notifications You must be signed in to change notification settings

voxpelli/node-webmention-testpinger

Repository files navigation

WebMention Test Pinger

npm version npm downloads Module type: CJS Follow @voxpelli@mastodon.social

A tool to ping your site with a variety of WebMentions markup. Contains copies of a couple of real world examples of mentions that it enables you to ping locally to a development copy of your site.

Real world sites included

Test suites included

Usage on CLI

First install from NPM:

npm install -g webmention-testpinger

Then run by doing:

webmention-testpinger --endpoint=http://example.com/endpoint --target=http://example.com/target

This tool will spin up a server on port 8080 and then ping the specified WebMentions hub with a URL to that server or each real world example which will return a copy of that example with a placeholder URL replaced with the requested mention target. After all pinged mentions has been fetched it will shut down the server and finish its execution.

Options

To list all available options, run:

webmention-testpinger --help

Usage in Node.js project

First add it from NPM:

npm install webmention-testpinger --save-dev

Then require it and set it up:

var WebMentionTemplates = require('webmention-testpinger').WebMentionTemplates;

var templateCollection = new WebMentionTemplates();

templateCollection.getTemplateNames().then(function (templateNames) {
  // "templateNames" contains an array of the names of all available templates
});

templateCollection.getTemplate(templateName, templateTarget).then(function (template) {
  // "template" contains the rendered HTML for the template with the name "templateName"
  // and has its webmention targeted at the "templateTarget" target URL
});

Options

One can send an object into new WebMentionTemplates() to define some options. The possible ones are:

  • templatePath – an absolute path to a folder in which a bunch of templates can be found

Requirements for CLI

  • Node.js (with npm)
  • Local copy of the hub you want to ping