refactor Nodeinfo for more strait implementation
This commit is contained in:
parent
6a52d79a84
commit
0345c50e2d
1 changed files with 31 additions and 17 deletions
|
@ -13,14 +13,37 @@ use Friendica\Core\System;
|
||||||
*/
|
*/
|
||||||
class NodeInfo extends BaseModule
|
class NodeInfo extends BaseModule
|
||||||
{
|
{
|
||||||
|
public static function init()
|
||||||
|
{
|
||||||
|
$config = self::getApp()->getConfig();
|
||||||
|
|
||||||
|
if (!$config->get('system', 'nodeinfo')) {
|
||||||
|
System::httpExit(404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function rawContent()
|
||||||
|
{
|
||||||
|
$app = self::getApp();
|
||||||
|
|
||||||
|
// @TODO: Replace with parameter from router
|
||||||
|
// if the first argument is ".well-known", print the well-known text
|
||||||
|
if (($app->argc > 1) && ($app->argv[0] == '.well-known')) {
|
||||||
|
self::printWellKnown($app);
|
||||||
|
// otherwise print the nodeinfo
|
||||||
|
} else {
|
||||||
|
self::printNodeInfo($app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the Nodeinfo for a well-known request
|
* Prints the well-known nodeinfo redirect
|
||||||
*
|
*
|
||||||
* @param App $app
|
* @param App $app
|
||||||
*
|
*
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function printWellKnown(App $app)
|
private static function printWellKnown(App $app)
|
||||||
{
|
{
|
||||||
$config = $app->getConfig();
|
$config = $app->getConfig();
|
||||||
|
|
||||||
|
@ -39,24 +62,15 @@ class NodeInfo extends BaseModule
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function init()
|
/**
|
||||||
|
* Print the nodeinfo
|
||||||
|
*
|
||||||
|
* @param App $app
|
||||||
|
*/
|
||||||
|
private static function printNodeInfo(App $app)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
|
||||||
$config = $app->getConfig();
|
$config = $app->getConfig();
|
||||||
|
|
||||||
if (!$config->get('system', 'nodeinfo')) {
|
|
||||||
System::httpExit(404);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($app->argc != 2) || ($app->argv[1] != '1.0')) {
|
|
||||||
self::printWellKnown($app);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function rawContent()
|
|
||||||
{
|
|
||||||
$config = self::getApp()->getConfig();
|
|
||||||
|
|
||||||
$smtp = (function_exists('imap_open') && !$config->get('system', 'imap_disabled') && !$config->get('system', 'dfrn_only'));
|
$smtp = (function_exists('imap_open') && !$config->get('system', 'imap_disabled') && !$config->get('system', 'dfrn_only'));
|
||||||
|
|
||||||
$nodeinfo = [
|
$nodeinfo = [
|
||||||
|
|
Loading…
Reference in a new issue