Skip to content

Hello IndieWeb! Today is the big day - the first day of december, and Sven Knebel told me in the chat that we have an IndieWeb Challenge to ship something every day for IndieWeb in December. I guess I’ll be the first one who adds to the calendar!

My ship for the December 1st is my new Micropub endpoint which is written in Python with Flask and is blazing fast! It actually won’t be just Micropub - it will host my Microsub server, Webmentions and IndieAuth in the future. Also I’m considering to make it a full-blown blogging engine which will ship dynamic pages.

The repository for it is here, but I need to polish the config for it to become universal (for now you need to edit __init__.py to adapt the app). A bit of documentation will be following (with bits on how my site is built).

Core setup

The core setup is Hugo-based directory (REPO parameter in the config). This directory needs to be a git repository which will be deployed if you use git push on it. (Hugo is a static site generator which I use for my site)

The structure for folders is looking something like this (most folders were omitted, the following ones are ones that my software automatically touches):

$REPO
|- content/
|  |- note/
|  |- reply/
|  |- photo/
|  |- post/
|  \- like/
\- static/
   \- uploads/

This reflects the structure of my site with several post types (Hugo calls these “kinds” and the folders “taxonomies”).

Features

The Micropub endpoint

The endpoint resides at /api/micropub. It supports following post kinds: - notes

  • articles (pass name property)

  • photo posts (pass photo or photo[] property)

  • likes (pass like-of property)

  • replies (pass in-reply-to property)

The array handling is forgiving; it handles array properties with or without [] (the latter is standard, the former is not).

The photo parameter may contain an encoded file (think curl -F photo@photo.png) or an URL. In former case, the file will be saved to uploads/ directory with a Unix timestamp. In latter, the URL will be embedded in the post directly! (This has a pitfall: if the original URL will be removed, the post will break. I’m working on it.)

The reply’s h-entry data will be embedded directly in the post. It will be static and will never be changed. I’m considering the possibility of somehow rendering reply contexts dynamically and if HTTP 410 Gone is returned, return that instead.

The endpoint also can syndicate to Twitter and IndieNews (the latter requires features in my templates I have not built yet). New syndication sources could be added in the config section.

Also it can send Webmentions via Telegraph, but it only does so for replies and syndication. User mentions are planned, since the app is already parsing these.

The media endpoint

The media endpoint resides at /api/micropub/media (notice a pattern?) It will probably handle uploads later, but for now it returns HTTP 502 Bad Gateway. I inserted that by mistake, thinking it stands for “Not Implemented”.

Future plans

  • Microsub server - because Aperture saves only 7 days of posts and doesn’t have any paid plans yet. Maybe ship it in this December too?

  • newbase60 slugs by default. I already have a Python library for it, but I just need to integrate it.

  • respecting slug property - that wasn’t implemented in the old endpoint either.

  • Turning this into blogging engine - I think we need another one!