X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2F_well_known.php;h=33070a1ecdf4dc071d65aabd94b67f530be47efe;hb=db44ea0482e4cd2b9d74318f246343bb1b6e09aa;hp=5c8a3380fdb7561aeab4f08a49b03a734ed882c9;hpb=8974c147e03df876a7225af4412f4f79e4582b9c;p=friendica.git diff --git a/mod/_well_known.php b/mod/_well_known.php index 5c8a3380fd..33070a1ecd 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -1,5 +1,6 @@ argc > 1) { @@ -10,6 +11,9 @@ function _well_known_init(&$a){ case "x-social-relay": wk_social_relay($a); break; + case "nodeinfo": + nodeinfo_wellknown($a); + break; } } http_status_exit(404); @@ -21,26 +25,42 @@ function wk_social_relay(&$a) { define('SR_SCOPE_ALL', 'all'); define('SR_SCOPE_TAGS', 'tags'); - $subscribe = (bool)true; - $scope = SR_SCOPE_ALL; - //$scope = SR_SCOPE_TAGS; + $subscribe = (bool)get_config('system', 'relay_subscribe'); + + if ($subscribe) + $scope = get_config('system', 'relay_scope'); + else + $scope = ""; $tags = array(); if ($scope == SR_SCOPE_TAGS) { - $terms = q("SELECT DISTINCT(`term`) FROM `search`"); - foreach($terms AS $term) { - $tag = trim($term["term"], "#"); - $tags[] = $tag; + $server_tags = get_config('system', 'relay_server_tags'); + $tagitems = explode(",", $server_tags); + + foreach($tagitems AS $tag) + $tags[trim($tag, "# ")] = trim($tag, "# "); + + if (get_config('system', 'relay_user_tags')) { + $terms = q("SELECT DISTINCT(`term`) FROM `search`"); + + foreach($terms AS $term) { + $tag = trim($term["term"], "#"); + $tags[$tag] = $tag; + } } } + $taglist = array(); + foreach($tags AS $tag) + $taglist[] = $tag; + $relay = array("subscribe" => $subscribe, "scope" => $scope, - "tags" => array_unique($tags)); + "tags" => $taglist); header('Content-type: application/json; charset=utf-8'); - echo json_encode($relay, true); + echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES); exit; }