3 use \Friendica\Core\Config;
5 require_once("mod/hostxrd.php");
6 require_once("mod/nodeinfo.php");
8 function _well_known_init(App $a) {
14 case "x-social-relay":
18 nodeinfo_wellknown($a);
22 http_status_exit(404);
26 function wk_social_relay(App $a) {
28 $subscribe = (bool)Config::get('system', 'relay_subscribe', false);
31 $scope = Config::get('system', 'relay_scope', SR_SCOPE_ALL);
33 $scope = SR_SCOPE_NONE;
38 if ($scope == SR_SCOPE_TAGS) {
39 $server_tags = Config::get('system', 'relay_server_tags');
40 $tagitems = explode(",", $server_tags);
42 foreach($tagitems AS $tag) {
43 $tags[trim($tag, "# ")] = trim($tag, "# ");
46 if (Config::get('system', 'relay_user_tags')) {
47 $terms = q("SELECT DISTINCT(`term`) FROM `search`");
49 foreach($terms AS $term) {
50 $tag = trim($term["term"], "#");
57 foreach($tags AS $tag) {
61 $relay = array("subscribe" => $subscribe,
65 header('Content-type: application/json; charset=utf-8');
66 echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);