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 = [])
20 $config = DI::config();
22 header('Content-type: text/xml');
24 if (!$config->get('system', 'site_pubkey', false)) {
25 $res = Crypto::newKeypair(1024);
27 $config->set('system', 'site_prvkey', $res['prvkey']);
28 $config->set('system', 'site_pubkey', $res['pubkey']);
31 $tpl = Renderer::getMarkupTemplate('xrd_host.tpl');
32 echo Renderer::replaceMacros($tpl, [
33 '$zhost' => DI::baseUrl()->getHostname()(),
34 '$zroot' => $app->getBaseURL(),
35 '$domain' => $app->getBaseURL(),
36 '$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))