diff options
| -rw-r--r-- | routes/nodeinfo.php | 18 |
1 files changed, 14 insertions, 4 deletions
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 @@ <?php +use Digitigrade\Db; use Digitigrade\GlobalSettings; use Digitigrade\Model\Actor; use Digitigrade\Model\Note; @@ -19,22 +20,31 @@ Router::getInstance()->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 +}); |
