From: Philipp Holzer Date: Tue, 30 Apr 2019 20:36:28 +0000 (+0200) Subject: Adding to router X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e7f8d8c3b640c7729adec105ed6ce97829539389;p=friendica.git Adding to router --- diff --git a/mod/_well_known.php b/mod/_well_known.php index 3dbac799fd..3bd86ecc9c 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -3,7 +3,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\System; -use Friendica\Module\Hostxrd; +use Friendica\Module\HostMeta; use Friendica\Module\Nodeinfo; require_once 'mod/xrd.php'; @@ -13,7 +13,7 @@ function _well_known_init(App $a) if ($a->argc > 1) { switch ($a->argv[1]) { case "host-meta": - Hostxrd::printHostMeta(); + HostMeta::printHostMeta(); break; case "x-social-relay": wk_social_relay(); diff --git a/src/App/Router.php b/src/App/Router.php index 039d3e2cf9..53fe0689a6 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -42,6 +42,8 @@ class Router { $this->routeCollector->addRoute(['GET', 'POST'], '/itemsource[/{guid}]', Module\Itemsource::class); $this->routeCollector->addRoute(['GET'], '/amcd', Module\AccountManagementControlDocument::class); + $this->routeCollector->addRoute(['GET'], '/host-meta', Module\HostMeta::class); + $this->routeCollector->addRoute(['GET'], '/hostxrd', Module\HostMeta::class); } public function __construct(RouteCollector $routeCollector = null) diff --git a/src/Module/HostMeta.php b/src/Module/HostMeta.php new file mode 100644 index 0000000000..21953b5414 --- /dev/null +++ b/src/Module/HostMeta.php @@ -0,0 +1,51 @@ +getConfig(); + + header("Content-type: text/xml"); + + if (!$config->get('system', 'site_pubkey', false)) { + $res = Crypto::newKeypair(1024); + + $config->set('system','site_prvkey', $res['prvkey']); + $config->set('system','site_pubkey', $res['pubkey']); + } + + $tpl = Renderer::getMarkupTemplate('xrd_host.tpl'); + echo Renderer::replaceMacros($tpl, [ + '$zhost' => $app->getHostName(), + '$zroot' => $app->getBaseURL(), + '$domain' => $app->getBaseURL(), + '$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))] + ); + + exit(); + } +} diff --git a/src/Module/Hostxrd.php b/src/Module/Hostxrd.php deleted file mode 100644 index 4f95ebb451..0000000000 --- a/src/Module/Hostxrd.php +++ /dev/null @@ -1,51 +0,0 @@ -getConfig(); - - header("Content-type: text/xml"); - - if (!$config->get('system', 'site_pubkey', false)) { - $res = Crypto::newKeypair(1024); - - $config->set('system','site_prvkey', $res['prvkey']); - $config->set('system','site_pubkey', $res['pubkey']); - } - - $tpl = Renderer::getMarkupTemplate('xrd_host.tpl'); - echo Renderer::replaceMacros($tpl, [ - '$zhost' => $app->getHostName(), - '$zroot' => $app->getBaseURL(), - '$domain' => $app->getBaseURL(), - '$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))] - ); - - exit(); - } -}