From b051bdac7b76174a04cd50738a6618574cc44413 Mon Sep 17 00:00:00 2001 From: jade (winter) Date: Thu, 22 Jan 2026 10:51:27 +0000 Subject: improve nodeinfo response --- routes/nodeinfo.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'routes') diff --git a/routes/nodeinfo.php b/routes/nodeinfo.php index 5f7eb53..7de46b2 100644 --- a/routes/nodeinfo.php +++ b/routes/nodeinfo.php @@ -1,5 +1,6 @@ mount('/.well-known/nodeinfo', function (array $args) { 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() + 'version' => get_version(), + 'repository' => 'https://codeberg.org/winter/digitigrade' ], 'protocols' => ['pawpub'], 'services' => [ 'inbound' => [], - 'outbound' => [] + 'outbound' => ['atom1.0', 'rss2.0'] ], 'openRegistrations' => false, 'usage' => [ 'users' => [ 'total' => UserAccount::count() - ] + ], + 'localPosts' => $localNotes ], 'metadata' => [ 'nodeName' => $s->get('instance.name'), @@ -66,4 +76,4 @@ Router::getInstance()->mount('/.well-known/pawpub-instance', function (array $ar 'simplePush' => path_to_uri('/push/simple') ] ]); -}); \ No newline at end of file +}); -- cgit v1.3