webmention-testpinger

A tool to ping your site with a variety of webmention markup

WebMention Test Pinger

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.

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.

To list all available options, run:

webmention-testpinger --help

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 
});

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
  • Node.js (with npm)
  • Local copy of the hub you want to ping
  • Fix for when a ping request times out
  • Two new basic templates for interaction mentions
  • New feature for multiple mentions (through multiple --target CLI options) and a new basic template that make use of multiple mentions. Old templates are still single-mention.
  • Includes the HTTP code for a failure response and if there's a Retry-After header – print it
  • Uses the new chalk.dim() rather than chalk.grey() for the dim parts of the log – timestamp etc.
  • Updated some dependencies
  • Refactored the code to make it possible to require the template code from a Node.js project, thus making it possible to utilize the same templates as the CLI-tool within an automated test suite.
  • DX-enchancement: Grunt + linting tools added to keep track of coding style
  • Improved console messages. Now eg. color coded and have timestamps – the latter can be useful when eg. testing a throttling mechanism
  • Improved handling of failed pings in non-sync flow – sometimes the server didn't close itself
  • Added a special like WebMention example from sandeep.io, thanks Sandeep!
  • Added WebMention example from Tantek.com, thanks Tantek!
  • Changed the VoxPelli.com example to contain a <base> tag so that the relative avatar it uses can be resolved to voxpelli.com even though the site is served from the test server
  • Fixed error message regarding fetch of missing template
  • Added new option, --fetches/-f, to configure how many times each mention should be fetched before the tool closes down. Defaults to 1.
  • Added new option, --sync/-s, to provide alternative to --fetches where the tool keeps running until all ping requests has recieved responses.
  • Changed how port number is set, now done through new option --port/-p rather than through an enviromental variable.
  • Ensured that all instances of the placeholder URL is replaced
  • Added WebMention example from notizBlog.org, thanks Matthias!
  • Added WebMention example from Brid.gy, thanks Ryan! (And thanks for the link Matthias!)
  • Critical bug fix for listing the examples
  • Updated example on how to install and use
  • Minor fixes to improve the publishing on NPM
  • Added proper CLI option parsing thanks to noptify (and nopt)
  • Added binary to enable installation through NPM
  • Added WebMention example from Adactio.com, thanks Jeremy!
  • First version