3 namespace Friendica\Module\WellKnown;
5 use Friendica\BaseModule;
6 use Friendica\Core\Renderer;
7 use Friendica\Protocol\Salmon;
8 use Friendica\Util\Crypto;
11 * Prints the metadata for describing this host
12 * @see https://tools.ietf.org/html/rfc6415
14 class HostMeta extends BaseModule
16 public static function rawContent()
18 $app = self::getApp();
19 $config = $app->getConfig();
21 header("Content-type: text/xml");
23 if (!$config->get('system', 'site_pubkey', false)) {
24 $res = Crypto::newKeypair(1024);
26 $config->set('system','site_prvkey', $res['prvkey']);
27 $config->set('system','site_pubkey', $res['pubkey']);
30 $tpl = Renderer::getMarkupTemplate('xrd_host.tpl');
31 echo Renderer::replaceMacros($tpl, [
32 '$zhost' => $app->getHostName(),
33 '$zroot' => $app->getBaseURL(),
34 '$domain' => $app->getBaseURL(),
35 '$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))]