3 * @file mod/hostxrd.php
6 use Friendica\Core\Config;
7 use Friendica\Core\Renderer;
8 use Friendica\Core\System;
9 use Friendica\Protocol\Salmon;
10 use Friendica\Util\Crypto;
12 function hostxrd_init(App $a)
14 header('Access-Control-Allow-Origin: *');
15 header("Content-type: text/xml");
16 $pubkey = Config::get('system', 'site_pubkey');
19 $res = Crypto::newKeypair(1024);
21 Config::set('system','site_prvkey', $res['prvkey']);
22 Config::set('system','site_pubkey', $res['pubkey']);
25 $tpl = Renderer::getMarkupTemplate('xrd_host.tpl');
26 echo Renderer::replaceMacros($tpl, [
27 '$zhost' => $a->getHostName(),
28 '$zroot' => System::baseUrl(),
29 '$domain' => System::baseUrl(),
30 '$bigkey' => Salmon::salmonKey(Config::get('system', 'site_pubkey'))]