3 namespace Friendica\Module;
5 use Friendica\BaseModule;
6 use Friendica\Core\Renderer;
7 use Friendica\Protocol\Salmon;
8 use Friendica\Util\Crypto;
11 * Prints the host-meta text
13 class Hostxrd extends BaseModule
15 public static function rawContent()
19 self::printHostMeta();
23 * Prints the host-meta output of this node
25 * @throws \Friendica\Network\HTTPException\InternalServerErrorException
27 public static function printHostMeta()
29 $app = self::getApp();
30 $config = $app->getConfig();
32 header("Content-type: text/xml");
34 if (!$config->get('system', 'site_pubkey', false)) {
35 $res = Crypto::newKeypair(1024);
37 $config->set('system','site_prvkey', $res['prvkey']);
38 $config->set('system','site_pubkey', $res['pubkey']);
41 $tpl = Renderer::getMarkupTemplate('xrd_host.tpl');
42 echo Renderer::replaceMacros($tpl, [
43 '$zhost' => $app->getHostName(),
44 '$zroot' => $app->getBaseURL(),
45 '$domain' => $app->getBaseURL(),
46 '$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))]