mount('/.well-known/nodeinfo', function (array $args) { json_response([ 'links' => [ [ 'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.1', 'href' => path_to_uri('/nodeinfo/2.1') ] ] ], 'application/jrd+json'); }); Router::getInstance()->mount('/nodeinfo/2.1', function (array $args) { $s = GlobalSettings::getInstance(); $db = Db::getInstance()->getPdo(); $localNotes = $db->query( 'select count(*) from note ' . 'left join actor on actor.id=note.author ' . 'where actor.is_local', PDO::FETCH_COLUMN, 0 )->fetch(); json_response([ 'version' => '2.1', 'software' => [ 'name' => 'Digitigrade', 'version' => get_version(), 'repository' => 'https://codeberg.org/winter/digitigrade' ], 'protocols' => ['pawpub'], 'services' => [ 'inbound' => [], 'outbound' => ['atom1.0', 'rss2.0'] ], 'openRegistrations' => false, 'usage' => [ 'users' => [ 'total' => UserAccount::count() ], 'localPosts' => $localNotes ], 'metadata' => [ 'nodeName' => $s->get('instance.name'), 'nodeDescription' => $s->get('instance.description'), 'pawpub' => [ 'extensions' => [ Actor::EXTENSION_POKE, Note::EXTENSION_LINK_PREVIEWS, Note::EXTENSION_PAGES, ] ] ] ], 'application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.1#"'); }); Router::getInstance()->mount('/.well-known/pawpub-instance', function (array $args) { $s = GlobalSettings::getInstance(); json_response([ 'name' => $s->get('instance.name'), 'description' => $s->get('instance.description'), 'softwareName' => 'Digitigrade', 'softwareVersion' => get_version(), 'softwareDescription' => 'An experimental PawPub server', 'endpoints' => [ 'auth' => path_to_uri('/auth/main'), 'subscribe' => path_to_uri('/subscribe'), 'unsubscribe' => path_to_uri('/unsubscribe'), 'push' => path_to_uri('/push'), 'simplePush' => path_to_uri('/push/simple') ] ]); });