mirror of
https://github.com/friendica/friendica
synced 2025-04-21 15:10:12 +00:00
Inherit ApiResponse
from Response
This commit is contained in:
parent
561aba18e3
commit
537b74f307
46 changed files with 326 additions and 277 deletions
|
@ -21,11 +21,15 @@
|
|||
|
||||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Nodeinfo;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Version 1.0 of Nodeinfo 2, a sStandardized way of exposing metadata about a server running one of the distributed social networks.
|
||||
|
@ -33,30 +37,38 @@ use Friendica\Model\Nodeinfo;
|
|||
*/
|
||||
class NodeInfo210 extends BaseModule
|
||||
{
|
||||
/** @var IManageConfigValues */
|
||||
protected $config;
|
||||
|
||||
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManageConfigValues $config, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
$config = DI::config();
|
||||
|
||||
$nodeinfo = [
|
||||
'version' => '1.0',
|
||||
'server' => [
|
||||
'baseUrl' => DI::baseUrl()->get(),
|
||||
'name' => $config->get('config', 'sitename'),
|
||||
'version' => '1.0',
|
||||
'server' => [
|
||||
'baseUrl' => $this->baseUrl->get(),
|
||||
'name' => $this->config->get('config', 'sitename'),
|
||||
'software' => 'friendica',
|
||||
'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
|
||||
],
|
||||
'organization' => Nodeinfo::getOrganization($config),
|
||||
'organization' => Nodeinfo::getOrganization($this->config),
|
||||
'protocols' => ['dfrn', 'activitypub'],
|
||||
'services' => [],
|
||||
'openRegistrations' => intval($config->get('config', 'register_policy')) !== Register::CLOSED,
|
||||
'openRegistrations' => intval($this->config->get('config', 'register_policy')) !== Register::CLOSED,
|
||||
'usage' => [],
|
||||
];
|
||||
|
||||
if (!empty($config->get('system', 'diaspora_enabled'))) {
|
||||
if (!empty($this->config->get('system', 'diaspora_enabled'))) {
|
||||
$nodeinfo['protocols'][] = 'diaspora';
|
||||
}
|
||||
|
||||
if (empty($config->get('system', 'ostatus_disabled'))) {
|
||||
if (empty($this->config->get('system', 'ostatus_disabled'))) {
|
||||
$nodeinfo['protocols'][] = 'ostatus';
|
||||
}
|
||||
|
||||
|
@ -72,7 +84,7 @@ class NodeInfo210 extends BaseModule
|
|||
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
||||
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
||||
|
||||
if (function_exists('imap_open') && !$config->get('system', 'imap_disabled')) {
|
||||
if (function_exists('imap_open') && !$this->config->get('system', 'imap_disabled')) {
|
||||
$nodeinfo['services']['inbound'][] = 'imap';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue