Pure, framework-free code in federation/protocol: - media: ActivityPub content types and Accept negotiation - vocab: actor URLs, Person and Application actors (Mastodon's extension terms), public keys, collections, plain text to safe HTML - webfinger: acct:/actor-URL resource parsing (other domains and bad usernames rejected) and JRD documents - nodeinfo: discovery and NodeInfo 2.1; hostmeta: XRD pointing at WebFinger Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
20 lines
695 B
Python
20 lines
695 B
Python
"""NodeInfo 2.1 (https://nodeinfo.diaspora.software/): what software a server runs."""
|
|
|
|
SCHEMA_21 = "http://nodeinfo.diaspora.software/ns/schema/2.1"
|
|
|
|
|
|
def discovery(base_url: str) -> dict:
|
|
return {"links": [{"rel": SCHEMA_21, "href": f"{base_url}/nodeinfo/2.1"}]}
|
|
|
|
|
|
def document(*, version: str, users_total: int, open_registrations: bool) -> dict:
|
|
return {
|
|
"version": "2.1",
|
|
"software": {"name": "scrobbler", "version": version},
|
|
"protocols": ["activitypub"],
|
|
"services": {"inbound": [], "outbound": []},
|
|
"openRegistrations": open_registrations,
|
|
"usage": {"users": {"total": users_total}, "localPosts": 0},
|
|
"metadata": {},
|
|
}
|