2 /// @TODO This file has DOS line endings!
\r
3 require_once("mod/hostxrd.php");
\r
4 require_once("mod/nodeinfo.php");
\r
6 function _well_known_init(App &$a){
\r
8 switch($a->argv[1]) {
\r
12 case "x-social-relay":
\r
13 wk_social_relay($a);
\r
16 nodeinfo_wellknown($a);
\r
20 http_status_exit(404);
\r
24 function wk_social_relay(App &$a) {
\r
26 define('SR_SCOPE_ALL', 'all');
\r
27 define('SR_SCOPE_TAGS', 'tags');
\r
29 $subscribe = (bool)get_config('system', 'relay_subscribe');
\r
32 $scope = get_config('system', 'relay_scope');
\r
38 if ($scope == SR_SCOPE_TAGS) {
\r
40 $server_tags = get_config('system', 'relay_server_tags');
\r
41 $tagitems = explode(",", $server_tags);
\r
43 foreach($tagitems AS $tag)
\r
44 $tags[trim($tag, "# ")] = trim($tag, "# ");
\r
46 if (get_config('system', 'relay_user_tags')) {
\r
47 $terms = q("SELECT DISTINCT(`term`) FROM `search`");
\r
49 foreach($terms AS $term) {
\r
50 $tag = trim($term["term"], "#");
\r
57 foreach($tags AS $tag)
\r
60 $relay = array("subscribe" => $subscribe,
\r
62 "tags" => $taglist);
\r
64 header('Content-type: application/json; charset=utf-8');
\r
65 echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
\r