4 use Friendica\Core\Config;
6 require_once("mod/hostxrd.php");
7 require_once("mod/nodeinfo.php");
9 function _well_known_init(App $a) {
15 case "x-social-relay":
19 nodeinfo_wellknown($a);
23 http_status_exit(404);
27 function wk_social_relay(App $a) {
29 $subscribe = (bool)Config::get('system', 'relay_subscribe', false);
32 $scope = Config::get('system', 'relay_scope', SR_SCOPE_ALL);
34 $scope = SR_SCOPE_NONE;
39 if ($scope == SR_SCOPE_TAGS) {
40 $server_tags = Config::get('system', 'relay_server_tags');
41 $tagitems = explode(",", $server_tags);
43 foreach($tagitems AS $tag) {
44 $tags[trim($tag, "# ")] = trim($tag, "# ");
47 if (Config::get('system', 'relay_user_tags')) {
48 $terms = q("SELECT DISTINCT(`term`) FROM `search`");
50 foreach($terms AS $term) {
51 $tag = trim($term["term"], "#");
58 foreach($tags AS $tag) {
62 $relay = array("subscribe" => $subscribe,
66 header('Content-type: application/json; charset=utf-8');
67 echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);