4 use Friendica\Core\Config;
5 use Friendica\Core\System;
7 require_once 'mod/hostxrd.php';
8 require_once 'mod/nodeinfo.php';
9 require_once 'mod/xrd.php';
11 function _well_known_init(App $a)
14 switch ($a->argv[1]) {
18 case "x-social-relay":
22 nodeinfo_wellknown($a);
29 System::httpExit(404);
33 function wk_social_relay()
35 $subscribe = (bool) Config::get('system', 'relay_subscribe', false);
38 $scope = Config::get('system', 'relay_scope', SR_SCOPE_ALL);
40 $scope = SR_SCOPE_NONE;
45 if ($scope == SR_SCOPE_TAGS) {
46 $server_tags = Config::get('system', 'relay_server_tags');
47 $tagitems = explode(",", $server_tags);
49 foreach ($tagitems AS $tag) {
50 $tags[trim($tag, "# ")] = trim($tag, "# ");
53 if (Config::get('system', 'relay_user_tags')) {
54 $terms = q("SELECT DISTINCT(`term`) FROM `search`");
56 foreach ($terms AS $term) {
57 $tag = trim($term["term"], "#");
64 foreach ($tags AS $tag) {
69 "subscribe" => $subscribe,
74 header('Content-type: application/json; charset=utf-8');
75 echo json_encode($relay, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);