A minimalistic Go-powered jamstack-augmented microservice for webmentions etc
Go to file
Wouter Groeneveld 120e66553f PUT readme update 2021-03-17 19:06:37 +01:00
.github/workflows auto-run tests on github 2021-03-07 20:47:13 +01:00
.yarn/releases first commit! 👏 2021-03-07 20:30:14 +01:00
src replaceAll is node15+ 2021-03-17 18:54:07 +01:00
test webmention sending endpoint implementation 2021-03-17 18:10:40 +01:00
.editorconfig first commit! 👏 2021-03-07 20:30:14 +01:00
.gitattributes first commit! 👏 2021-03-07 20:30:14 +01:00
.gitignore save webmentions in separate domain folders, delete olders if requried 2021-03-08 16:15:22 +01:00
.pnp.js webmention sending endpoint implementation 2021-03-17 18:10:40 +01:00
.yarnrc.yml first commit! 👏 2021-03-07 20:30:14 +01:00
README.md PUT readme update 2021-03-17 19:06:37 +01:00
package.json webmention sending endpoint implementation 2021-03-17 18:10:40 +01:00
serve-my-jams.sublime-project first commit! 👏 2021-03-07 20:30:14 +01:00
yarn.lock webmention sending endpoint implementation 2021-03-17 18:10:40 +01:00

README.md

serve-my-jams 🥞

A minimalistic jamstack-augmented microservice for webmentions etc

Are you looking for a way to DO something with this? See https://github.com/wgroeneveld/jam-my-stack !

This is a set of minimalistic Koa-based microservices that aid you in your IndieWeb Jamstack coolness 😎 (name-dropping). While jam-my-stack is a set of scripts used to run at checkin-time, this is a dymamic service that handles requests.

Inspect how it's used on https://brainbaking.com/ - usually, a <link/> in your <head/> suffices:

<link rel="webmention" href="https://jam.brainbaking.com/webmention" />
<link rel="pingback" href="https://webmention.io/webmention?forward=https://jam.brainbaking.com/webmention" />

If you want to support the older pingback protocol, you can leverage webmenton.io's forward capabilities. Although I developed this primarily because webmention.io is not reliable - you've been warned.

What's in it?

1. Webmentions

1.1 POST /webmention

Post a webmention. Includes a lot of cross-checking and validating to guard against possible spam. See the W3C WebMention spec - or the source - for details.

Accepted form format:

    POST /webmention-endpoint HTTP/1.1
    Host: aaronpk.example
    Content-Type: application/x-www-form-urlencoded

    source=https://waterpigs.example/post-by-barnaby&
    target=https://aaronpk.example/post-by-aaron

Will result in a 202 Accepted - it handles things async. Stores in .json files in data/domain.

1.2 GET /webmention/:domain/:token

Retrieves a JSON array with relevant webmentions stored for that domain. The token should match. See config.js to fiddle with it yourself. Environment variables are supported, although I haven't used them yet.

1.3 PUT /webmention/:domain/:token

Sends out webmentions, based on the domain's index.xml RSS feed, and optionally, a since request query parameter that is supposed to be a string, fed through Dayjs to format. (e.g. 2021-03-16T16:00:00.000Z).

This does a couple of things:

  1. Fetch RSS entries (since x, or everything)
  2. Find outbound hrefs (starting with http)
  3. Check if those domains have a webmention link endpoint installed, according to the w3.org rules.
  4. If so: POST for each found href with source the own domain and target the outbound link found in the RSS feed.

As with the POST call, will result in a 202 Accepted and handles things async/in parallel.

TODOs

  • published date is not well-formatted and blindly taken over from feed
  • Implement a Brid.gy-like system that converts links from domains in the config found on public Mastodon timelines into webmentions. (And check if it's ok to only use the public line)