mirror of
https://github.com/friendica/friendica
synced 2025-04-19 11:10:10 +00:00
Modules separated
This commit is contained in:
parent
2d3296f697
commit
0979daddac
3 changed files with 45 additions and 30 deletions
43
src/Module/WellKnown/NodeInfo.php
Normal file
43
src/Module/WellKnown/NodeInfo.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Module\WellKnown;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
|
||||
self::printWellKnown($app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the well-known nodeinfo redirect
|
||||
*
|
||||
* @param App $app
|
||||
*
|
||||
* @throws \Friendica\Network\HTTPException\NotFoundException
|
||||
*/
|
||||
private static function printWellKnown(App $app)
|
||||
{
|
||||
$nodeinfo = [
|
||||
'links' => [
|
||||
['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
|
||||
'href' => $app->getBaseURL() . '/nodeinfo/1.0'],
|
||||
['rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0',
|
||||
'href' => $app->getBaseURL() . '/nodeinfo/2.0'],
|
||||
]
|
||||
];
|
||||
|
||||
header('Content-type: application/json; charset=utf-8');
|
||||
echo json_encode($nodeinfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue