3 * @copyright Copyright (C) 2020, Friendica
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Module;
24 use Friendica\BaseModule;
25 use Friendica\Core\Addon;
26 use Friendica\Core\System;
28 use Friendica\Model\Nodeinfo;
31 * Version 1.0 of Nodeinfo 2, a sStandardized way of exposing metadata about a server running one of the distributed social networks.
32 * @see https://github.com/jhass/nodeinfo/blob/master/PROTOCOL.md
34 class NodeInfo210 extends BaseModule
36 public static function rawContent(array $parameters = [])
38 $config = DI::config();
43 'baseUrl' => DI::baseUrl()->get(),
44 'name' => $config->get('config', 'sitename'),
45 'software' => 'friendica',
46 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
48 'organization' => Nodeinfo::getOrganization($config),
49 'protocols' => ['dfrn', 'activitypub'],
51 'openRegistrations' => intval($config->get('config', 'register_policy')) !== Register::CLOSED,
55 if (!empty($config->get('system', 'diaspora_enabled'))) {
56 $nodeinfo['protocols'][] = 'diaspora';
59 if (empty($config->get('system', 'ostatus_disabled'))) {
60 $nodeinfo['protocols'][] = 'ostatus';
63 $nodeinfo['usage'] = Nodeinfo::getUsage(true);
65 $nodeinfo['services'] = Nodeinfo::getServices();
67 if (Addon::isEnabled('twitter')) {
68 $nodeinfo['services']['inbound'][] = 'twitter';
71 $nodeinfo['services']['inbound'][] = 'atom1.0';
72 $nodeinfo['services']['inbound'][] = 'rss2.0';
73 $nodeinfo['services']['outbound'][] = 'atom1.0';
75 if (function_exists('imap_open') && !$config->get('system', 'imap_disabled') && !$config->get('system', 'dfrn_only')) {
76 $nodeinfo['services']['inbound'][] = 'imap';
79 System::jsonExit($nodeinfo, 'application/json; charset=utf-8', JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);