3 namespace Friendica\Module\WellKnown;
5 use Friendica\BaseModule;
6 use Friendica\Core\Renderer;
8 use Friendica\Protocol\Salmon;
9 use Friendica\Util\Crypto;
12 * Prints the metadata for describing this host
13 * @see https://tools.ietf.org/html/rfc6415
15 class HostMeta extends BaseModule
17 public static function rawContent(array $parameters = [])
19 $config = DI::config();
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' => DI::baseUrl()->getHostname()(),
33 '$zroot' => DI::baseUrl()->get(),
34 '$domain' => DI::baseUrl()->get(),
35 '$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))