DasBlog support for WebFinger

I have been on Twitter since about 2009, at that point it had already moved from being predominantly driven by texting to a fully featured app on the two dominant smartphone platforms. By this time I had also missed most of the outages characterized by the infamous blue whale. I have always had a terse relationship with Twitter, not in the character limitation sense, but in the sense that I dislike giving the platform my best words and ideas without actually creating a blog post as the root of the conversation.

So given the seasons and changing tides I, like some of you, am experimenting with alternative microblogging solutions, my primary focus today being Mastodon. The description of Mastodon is as follows:

Social networking that's not for sale.

Your home feed should be filled with what matters to you most, not what a corporation thinks you should see. Radically different social media, back in the hands of the people.

You know best what you want to see on your home feed. No algorithms or ads to waste your time. Follow anyone across any Mastodon server from a single account and receive their posts in chronological order, and make your corner of the internet a little more like you.

What makes these radical characteristics possible is that this social platform is distributed across multiple servers that are owned and managed by their own communities, these heterogenous communities are federated with each other to produce a much larger homogenous social network.

Anyone can create a Mastodon server, and join the federation, I am wondering then if the blogs we already own can also join the federation too? In fact I noticed that my colleague Gus mapped his custom domain to his own Mastodon account, and this has me thinking, could I do the same thing for DasBlog?

Discovery powered by WebFinger

Joining a decentralized social networking necessarily requires a shared protocol, in this case it is powered by ActivityStreams 2.0 data format and JSON-LD. I am hoping to bring this protocol into DasBlog over time starting with WebFinger.

Suppose we want to lookup my user id @poppastring hosted on the dotnet.social site, you can make a request to that domain’s /.well-known/webfinger endpoint, with the resource query parameter set to an acct: URI. Your curl command should look something like this:

curl -H "Accept: application/jrd+json" -H "Content-Type: application/json" 
         https://dotnet.social/.well-known/webfinger?resource=acct:poppastring@dotnet.social

The result of this query produces the following JSON formatted response:

{
    "subject":"acct:poppastring@dotnet.social",
    "aliases":[
        "https://dotnet.social/@poppastring",
        "https://dotnet.social/users/poppastring"
    ],
    "links":[
        {
            "rel":"http://webfinger.net/rel/profile-page",
            "type":"text/html",
            "href":"https://dotnet.social/@poppastring"
        },
        {
            "rel":"self",
            "type":"application/activity+json",
            "href":"https://dotnet.social/users/poppastring"
        },
        {
            "rel":"http://ostatus.org/schema/1.0/subscribe",
            "template":"https://dotnet.social/authorize_interaction?uri={uri}"
        }
    ]
}

Implementing this equivalent query into DasBlog was fairly straightforward, I accomplished that by creating an ActivityPubController (plus a small update to you config settings). However, to use DasBlog for the purpose of federated custom domain searches, the default location of the the blog needs to be at the root of the site, which mine is not. For IIS based hosting you can perform a rewrite (via web.config) for any queries sent to /.well-known/webfinger to the directory where your blog is located. Mine is located in blog/.well-known/webfinger, and the rewrite looks like this:

<rewrite>
   <rules>
      <rule name="Support for webfinger" stopProcessing="true">
         <match url="^\.well-known/webfinger" />
         <action type="Rewrite" url="blog/{R:0}" />
      </rule>
   </rules>
</rewrite>

This is step one, there is a whole ActivityPub to implement. This should be fun!

Sun setting through cirrus clouds over Elliot Bay in Seattle


Comment Section

Comments are closed.