friendica/src/Module/WellKnown/NodeInfo.php

58 lines
1.7 KiB
PHP
Raw Normal View History

2019-11-28 07:07:34 +00:00
<?php
2020-02-09 14:45:36 +00:00
/**
2022-01-02 07:27:47 +00:00
* @copyright Copyright (C) 2010-2022, the Friendica project
2020-02-09 14:45:36 +00:00
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
2019-11-28 07:07:34 +00:00
namespace Friendica\Module\WellKnown;
use Friendica\BaseModule;
2022-04-09 11:58:01 +00:00
use Friendica\Core\System;
use Friendica\DI;
2019-11-28 07:07:34 +00:00
/**
* Standardized way of exposing metadata about a server running one of the distributed social networks.
* @see https://github.com/jhass/nodeinfo/blob/master/PROTOCOL.md
*/
class NodeInfo extends BaseModule
{
protected function rawContent(array $request = [])
2019-11-28 07:07:34 +00:00
{
self::printWellKnown();
2019-11-28 07:07:34 +00:00
}
/**
* Prints the well-known nodeinfo redirect
*
* @throws \Friendica\Network\HTTPException\NotFoundException
*/
private static function printWellKnown()
2019-11-28 07:07:34 +00:00
{
$nodeinfo = [
'links' => [
['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
'href' => DI::baseUrl()->get() . '/nodeinfo/1.0'],
2019-11-28 07:07:34 +00:00
['rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0',
'href' => DI::baseUrl()->get() . '/nodeinfo/2.0'],
2019-11-28 07:07:34 +00:00
]
];
2022-04-09 11:58:01 +00:00
System::jsonExit($nodeinfo);
2019-11-28 07:07:34 +00:00
}
}