Creating a generic "Log-in with Mastodon" service


A padlock engraved into a circuit board.

Let's say you have a website - your_website.tld - and you want people to log in to it using their Mastodon account. For a traditional social-media site like Twitter or Facebook, you would create an OAuth app on the service that you want. But there are hundreds of Mastodon servers. So you need to create a new app for each one. That sounds hard, but it isn't. Well… not too hard. Here's some code adapted from Infosec.press. It's all written using cURL on the command line - so you should be a…

Continue reading →

Untappd to Mastodon - Updated!


A bottle of beer outside on a sunny day.

A few years ago, I wrote some code to post Untappd check-ins to Mastodon. I've recently updated it to also post a photo of the beer you're enjoying. First up, you'll need a file called config.py to hold all your API keys: instance = "https://mastodon.social" access_token = "…" write_access_token = "…" untappd_client_id = "…" untappd_client_secret = "…" Then a file called untappd2mastodon.py to do the job of grabbing your …

Continue reading →

How far did my post go on the Fediverse?


Cartoon of a tusked mastodon holding a phone.

I wrote a moderately popular post on Mastodon. Lots of people shared it. Is it possible to find out how many different ActivityPub servers it went to? Yes! As we all know, the Fediverse is one big chain mail. I don't mean that in a derogatory way. When I write a post, it appears on my server (called an "instance" in Mastodon-speak). Everyone on my instance can see my post. My instance looks at all my followers - some of whom are on completely different instances - and sends my post to…

Continue reading →

On The Fediverse, No One Knows You're A Liar


Screenshot of the Mastodon interface. It claims the user has 97 million posts, follows 97 thousand people, and is followed by 97 billion accounts. It's join date is March 1997.

One of the reasons I'm still on the original Mastodon.social instance is that I am vain. I joined shortly after the project was announced and, as a consequence, I have a "joined" date of 2016 and a user ID of under 10,000. This doesn't make me an "elder statesman" and is rarely useful beyond bragging rights. If I moved to a different server, my "birthday" would be irrevocably lost 😢 But… what if I moved to a self-hosted Mastodon instance? Why! Then the database would be under my complete cont…

Continue reading →

Some thoughts on Mastodon search


Cartoon of a tusked mastodon holding a phone.

The latest version of Mastodon includes search functionality. It's early days, but seems to work pretty well. Here are some of the interesting things I found when using it. Search is complex - expectations I don't mean the act of searching a database - that's routine - but I mean it is socially complex. Lots of people left Twitter because it was too easy to search for them. For example, if you really hate people who support the wrong football team, it's trivial to search Twitter for people…

Continue reading →

How do you decentralise emergency alerts?


Cartoon of a tusked mastodon holding a phone.

Twitter's decision to hobble its API has meant that a number of useful alerting bots might no longer function. Your local subway might not be able to Tweet each morning about delays on the line, nor will a tornado warning be displayed as you scroll through photos of brunch, and forget about flood alerts between your memes. In one sense, this is sad. A set of useful public services are being cut off from their audience. My friend, Bill Thompson, described this as "unnecessary disruption" I, on…

Continue reading →

Posting Untappd Checkins to Mastodon (and other services)


HTML source code of the page.

I'm a big fan of Untappd. It's a social drinking app which lets you check in to a beer and rate it. Look, we all need hobbies, mine is drinking cider. You can see a list of everything I've drunk over the 13 last years. Nearly 900 different pints! After checking in, the app automatically posts to Twitter. But who wants to prop up Alan's failing empire? Not me! So here's some quick code to liberate your data and post it elsewhere. There are two ways - APIs and Screen Scraping. API First up,…

Continue reading →

Snowflake IDs in Mastodon (and Unique IDs in the Fediverse more generally)


Hundreds of snowflakes - each one unique and beautiful.

Computer Science has two canonical "hard problems": cache invalidation naming things off-by-one errors Let's talk about how we name unique items in Federated services - for example, posts on a social media service. If you have only one service, it's pretty easy. Every time a new entry is created in a database, give it a sequential number. This becomes a problem at scale. If you have millions of users on hundreds of different shards of a database, eventually you'll get a clash of IDs. To …

Continue reading →

WebMentions, Privacy, and DDoS - Oh My!


Crappy line drawing explaining the above.

Mastodon - the distributed social network - has two interesting challenges when it comes to how users share links. I'd like to discuss those issues and suggest a possible way forward. When you click on a link on my website which takes you to another website, your browser sends a Referer. This says to the other site "Hey, I came here using a link on shkspr.mobi". This is useful because it lets a site owner know who is linking to them. I love seeing which weird and wonderful sites have linked …

Continue reading →

Getting Started with Mastodon's Conversations API


A threaded conversation. You can see the order in which people have replied to each other - and what posts they are referencing.

The social network service "Mastodon" allows people to publish posts. People can reply to those posts. Other people can reply to those replies - and so on. What does that look like in the API? Here's a quick guide to the concepts you need to know - and some code to help you visualise conversations. When you scroll through the website, you normally see a list of replies. It looks like this: Because it acts as a one-dimensional list, there's no easy way to figure out which post someone is…

Continue reading →

Twitter's archive doesn't have alt text - but Mastodon's does!


The Twitter logo drawn in circles.

Because I don't trust Alan, the Hyperprat who now runs Twitter, I decided to download my Twitter archive before setting my account to dormant. About a decade ago, I wrote about how the Twitter archive works and where it is deficient. Things have got better, but there are still annoying limitations. For example, Hannah Kolbeck - founder of the Alt Text Reminder Bot recently pointed out that there's no alt text in the archives. Here's a snippet of Twitter's JSON for an image I posted: …

Continue reading →