4 use Friendica\Core\Config;
6 require_once("mod/hostxrd.php");
7 require_once("mod/nodeinfo.php");
8 require_once("mod/xrd.php");
10 function _well_known_init(App $a) {
16 case "x-social-relay":
20 nodeinfo_wellknown($a);
27 http_status_exit(404);
31 function wk_social_relay(App $a) {
33 $subscribe = (bool)Config::get('system', 'relay_subscribe', false);
36 $scope = Config::get('system', 'relay_scope', SR_SCOPE_ALL);
38 $scope = SR_SCOPE_NONE;
43 if ($scope == SR_SCOPE_TAGS) {
44 $server_tags = Config::get('system', 'relay_server_tags');
45 $tagitems = explode(",", $server_tags);
47 foreach($tagitems AS $tag) {
48 $tags[trim($tag, "# ")] = trim($tag, "# ");
51 if (Config::get('system', 'relay_user_tags')) {
52 $terms = q("SELECT DISTINCT(`term`) FROM `search`");
54 foreach($terms AS $term) {
55 $tag = trim($term["term"], "#");
62 foreach($tags AS $tag) {
66 $relay = array("subscribe" => $subscribe,
70 header('Content-type: application/json; charset=utf-8');
71 echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);