2022-01-06 14:26:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @copyright 2021 Podlibre
|
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
* @link https://castopod.org/
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Modules\Fediverse\Controllers;
|
|
|
|
|
|
|
|
use CodeIgniter\Controller;
|
|
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
|
|
|
|
|
|
class NodeInfo2Controller extends Controller
|
|
|
|
{
|
|
|
|
public function index(): ResponseInterface
|
|
|
|
{
|
2022-02-05 11:40:30 +00:00
|
|
|
$totalUsers = model('ActorModel', false)
|
2022-01-06 14:26:03 +00:00
|
|
|
->getTotalLocalActors();
|
2022-02-05 11:40:30 +00:00
|
|
|
$totalPosts = model('PostModel', false)
|
2022-01-06 14:26:03 +00:00
|
|
|
->getTotalLocalPosts();
|
2022-02-05 11:40:30 +00:00
|
|
|
$activeMonth = model('ActorModel', false)
|
2022-01-06 14:26:03 +00:00
|
|
|
->getActiveLocalActors(1);
|
2022-02-05 11:40:30 +00:00
|
|
|
$activeHalfyear = model('ActorModel', false)
|
2022-01-06 14:26:03 +00:00
|
|
|
->getActiveLocalActors(6);
|
|
|
|
|
|
|
|
$nodeInfo2 = [
|
|
|
|
'version' => '1.0',
|
|
|
|
'server' => [
|
|
|
|
'baseUrl' => base_url(),
|
|
|
|
'name' => service('settings')
|
|
|
|
->get('App.siteName'),
|
|
|
|
'software' => 'Castopod Host',
|
|
|
|
'version' => CP_VERSION,
|
|
|
|
],
|
|
|
|
'protocols' => ['activitypub'],
|
|
|
|
'openRegistrations' => config('Auth')
|
|
|
|
->allowRegistration,
|
|
|
|
'usage' => [
|
|
|
|
'users' => [
|
|
|
|
'total' => $totalUsers,
|
|
|
|
'activeMonth' => $activeMonth,
|
|
|
|
'activeHalfyear' => $activeHalfyear,
|
|
|
|
],
|
|
|
|
'localPosts' => $totalPosts,
|
|
|
|
],
|
|
|
|
];
|
|
|
|
|
|
|
|
return $this->response->setJSON($nodeInfo2);
|
|
|
|
}
|
|
|
|
}
|