Utilize your own user @ domain for Mastodon discoverability with the WebFinger Procedure without hosting a server

.
.

Mastodon is a complimentary, open-source social networking service that is decentralized and dispersed. It was developed in 2016 as an option to centralized social networks platforms such as Facebook and twitter.

Among the essential functions of Mastodon is using the WebFinger procedure, which enables users to find and gain access to details about other users on the Mastodon network. WebFinger is an easy HTTP-based procedure that makes it possible for a user to find details about other users or resources on the web by utilizing their e-mail address or other determining details. The WebFinger procedure is very important for Mastodon due to the fact that it makes it possible for users to discover and follow each other on the network, despite where they are hosted.

WebFinger utilizes a “popular” course structure when calling an domain. You might recognize with the robots.txt convention. All of us simply concur that robots.txt will sit on top course of everybody’s domain.

The WebFinger procedure is an easy HTTP-based procedure that makes it possible for a user or search to find details about other users or resources on the web by utilizing their e-mail address or other determining details. My is very first name at last name.com, so … my individual WebFinger API endpoint is here https://www.hanselman.com/.well-known/webfinger

The concept is that …

  1. A user sends out a WebFinger demand to a server, utilizing the e-mail address or other determining details of the user or resource they are attempting to find.

  2. The server searches for the inquired in its database and returns a JSON things including the details about the user or resource. This JSON things is called a “resource descriptor.”

  3. The user’s customer gets the resource descriptor and shows the details to the user.

The resource descriptor consists of different kinds of details about the user or resource, such as their name, profile image, and links to their social networks accounts or other online resources. It can likewise consist of other kinds of details, such as the user’s public secret, which can be utilized to develop a safe and secure connection with the user.

There’s a terrific explainer here too From that page:

When somebody look for you on Mastodon, your server will be queried for accounts utilizing an endpoint that appears like this:

GET https://$ {MASTODON_DOMAIN}/. well-known/webfinger? resource= acct:$ {MASTODON_USER} @$ {MASTODON_DOMAIN}

Keep in mind that Mastodon user names begin with @ so they are @username @someserver. com. Much like twiter would be @shanselman @twitter. com I can be @shanselman @hanselman. com now!

Searching for me with Mastodon

So maybe https://www.hanselman.com/.well-known/webfinger?resource=acct:[email protected]

Mine returns

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

This file ought to be returned as a mime kind of application/jrd+ json

My website is an ASP.NET Razor Pages website, so I simply did this in Startup.cs to map that popular URL to a page/route that returns the JSON required.

 services.AddRazorPages(). AddRazorPagesOptions( choices =>>
{
options.Conventions.AddPageRoute("/ robotstxt", "/ Robots.Txt");// i did this in the past, not required
options.Conventions.AddPageRoute("/ webfinger", "/. well-known/webfinger");
options.Conventions.AddPageRoute("/ webfinger", "/. well-known/webfinger/ {val?} ");
} );

then I made a webfinger.cshtml like this. Note I need to double leave the @@ websites due to the fact that it’s Razor.

 @page
@ {
Design = null;
this.Response.ContentType="application/jrd+ json";
}
{
" subject":" acct:[email protected]",
" aliases":
[
"https://hachyderm.io/@@shanselman",
"https://hachyderm.io/users/shanselman"
],
" links":
[
{
"rel":"http://webfinger.net/rel/profile-page",
"type":"text/html",
"href":"https://hachyderm.io/@@shanselman"
},
{
"rel":"self",
"type":"application/activity+json",
"href":"https://hachyderm.io/users/shanselman"
},
{
"rel":"http://ostatus.org/schema/1.0/subscribe",
"template":"https://hachyderm.io/authorize_interaction?uri={uri}"
}
]
}

This is a fixed reaction, however if I was hosting pages for more than a single person I ‘d wish to take in the url with the user’s name, and after that map it to their aliases and return those properly.

Even simpler, you can simply utilize the JSON file of your own Mastodon server’s webfinger reaction and wait as a fixed json file and copy it to your own server!

As long as your server returns the best JSON from that popular URL then it’ll work.

So this is my design template https://hachyderm.io/.well-known/webfinger?resource=acct:[email protected] from where I’m hosted now.

If you wish to start with Mastodon, start here. https://github.com/joyeusenoelle/GuideToMastodon/ it seems like Twitter circa 2007 other than it’s not owned by anybody and is based upon web requirements like ActivityPub.

Hope this assists!

.
.
. .

About Scott

Scott Hanselman is a previous teacher, previous Chief Designer in financing, now speaker, expert, dad, diabetic, and Microsoft staff member. He is an unsuccessful comic, a cornrower, and a book author.

facebook
twitter
subscribe
About Newsletter

Hosting By
Hosted in an Azure App Service

.
.
.
.
.
. . .



.

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: