on the topic of ActivityPub: .well-known

as of recent, i've took upon myself the horrible and daring task of developing a, god forbid, ActivityPub server. i've done a lot of research into it, reading upon a lot of blog posts detailing what you have to implement and whatnot...

every single blogpost tells you that .well-known only hosts webfinger, but what if i've told you that there's more than just that?

.well-known/nodeinfo

this one is actually a spec originally made for diaspora*, that one social networking platform that sorta exists and absolutely refuses to do anything with ActivityPub.

nodeinfo is a “standardized” way of querying information about an instance, such as its user count, blocked instances, software it's running, etc... etc...

it's the way, for example, how Akkoma or Misskey queries an instance about what instance its running, to display it on the frontend.

when queried, it returns a json JRD document describing every version of the nodeinfo protocol that the server supports:

{
    "links":
    [
        {
            "rel": "http://nodeinfo.diaspora.software/ns/schema/2.0",
            "href": "https://miku.place/nodeinfo/2.0.json"
        },
        {
            "rel": "http://nodeinfo.diaspora.software/ns/schema/2.1",
            "href": "https://miku.place/nodeinfo/2.1.json"
        }
    ]
}

from which you can select the version you want to query and fetch the information from it.

while it's absolutely safe to skip, a lot of instances actually fetch and make use of the information from it, which makes it worth implementing. (like come on, even snac has it, fucking snac)

for a more detailed look on it, i recommend checking https://github.com/jhass/nodeinfo

.well-known/host-meta

this one i have to admit i don't understand THAT well, but from what i've understood, it acts as a way for other instances to discover where the webfinger endpoint of your instance is.

so, given a scenario like this:

someone queries @person@example.com, but when looking up the actor your instance sees that https://example.com/.well-known/webfinger doesn't exist, so it looks up the host-meta, and finds out that, oh, your instance and the webfinger endpoint is actually at https://fedi.example.com/.well-known/webfinger instead.

and believe me, a lot of servers actually reside on a different address than they report... (looking at you layer02.net)

also as a side note, for some reason, this is the only endpoint that all instances implement that when queried, returns an XML response instead of JSON(-LD)???

<?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
   <Link type="application/xrd+xml" template="https://miku.place/.well-known/webfinger?resource={uri}" rel="lrdd" />
</XRD>

addendum, or wtf is going on with webfinger

this is more of a curiosity, but a lot of instances seem to expose an extra link with each webfinger query that looks akin to this

{
    "rel": "http://ostatus.org/schema/1.0/subscribe",
    "template": "https://miku.place/ostatus_subscribe?acct={uri}"
}

from what i've understood, it's used for remote following (or at least brings to a remote follow page for both Akkoma and Sharkey)

i've never seen anyone make use of it though, and the rel link has died long ago, and now redirects to some scam sports betting page lmao