diff options
| author | winter | 2025-01-18 21:33:47 +0000 |
|---|---|---|
| committer | winter | 2025-01-18 21:33:47 +0000 |
| commit | 5d55ae009cab1fe82f456111585d20795f4e865a (patch) | |
| tree | abf21d6329d9aeb94f8248f3b1f9ef1d5202c7ed /routes/nodeinfo.php | |
| parent | 43933d556499e84094dd9667a5325584ebe5fe43 (diff) | |
show instance and version info in nodeinfo and such
Diffstat (limited to 'routes/nodeinfo.php')
| -rw-r--r-- | routes/nodeinfo.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/routes/nodeinfo.php b/routes/nodeinfo.php index 92f1f7b..2fef63b 100644 --- a/routes/nodeinfo.php +++ b/routes/nodeinfo.php @@ -1,5 +1,7 @@ <?php +use Digitigrade\GlobalSettings; +use Digitigrade\Model\UserAccount; use Digitigrade\Router; Router::getInstance()->mount('/.well-known/nodeinfo', function (array $args) { @@ -14,11 +16,12 @@ Router::getInstance()->mount('/.well-known/nodeinfo', function (array $args) { }); Router::getInstance()->mount('/nodeinfo/2.1', function (array $args) { + $s = GlobalSettings::getInstance(); json_response([ 'version' => '2.1', 'software' => [ 'name' => 'Digitigrade', - 'version' => '0.1.0' + 'version' => get_version() ], 'protocols' => ['pawpub'], 'services' => [ @@ -28,12 +31,12 @@ Router::getInstance()->mount('/nodeinfo/2.1', function (array $args) { 'openRegistrations' => false, 'usage' => [ 'users' => [ - 'total' => 1 + 'total' => UserAccount::count() ] ], 'metadata' => [ - 'nodeName' => 'A Digitigrade server', - 'nodeDescription' => 'nodeinfo is hardcoded for now', + 'nodeName' => $s->get('instance.name'), + 'nodeDescription' => $s->get('instance.description'), 'pawpub' => [ 'extensions' => [ // 'https://whatever.example/ext/meow', @@ -44,11 +47,12 @@ Router::getInstance()->mount('/nodeinfo/2.1', function (array $args) { }); Router::getInstance()->mount('/.well-known/pawpub-instance', function (array $args) { + $s = GlobalSettings::getInstance(); json_response([ - 'name' => 'A Digitigrade server', - 'description' => 'metadata is hardcoded for now', + 'name' => $s->get('instance.name'), + 'description' => $s->get('instance.description'), 'softwareName' => 'Digitigrade', - 'softwareVersion' => '0.1.0', + 'softwareVersion' => get_version(), 'softwareDescription' => 'An experimental PawPub server', 'endpoints' => [ 'auth' => path_to_uri('/auth/main'), |
