<?php\r
require_once("mod/hostxrd.php");\r
+require_once("mod/nodeinfo.php");\r
\r
function _well_known_init(&$a){\r
if ($a->argc > 1) {\r
case "x-social-relay":\r
wk_social_relay($a);\r
break;\r
+ case "nodeinfo":\r
+ nodeinfo_wellknown($a);\r
+ break;\r
}\r
}\r
http_status_exit(404);\r
define('SR_SCOPE_ALL', 'all');\r
define('SR_SCOPE_TAGS', 'tags');\r
\r
- $subscribe = (bool)true;\r
- $scope = SR_SCOPE_ALL;\r
- //$scope = SR_SCOPE_TAGS;\r
+ $subscribe = (bool)get_config('system', 'relay_subscribe');\r
+\r
+ if ($subscribe)\r
+ $scope = get_config('system', 'relay_scope');\r
+ else\r
+ $scope = "";\r
\r
$tags = array();\r
\r
if ($scope == SR_SCOPE_TAGS) {\r
- $terms = q("SELECT DISTINCT(`term`) FROM `search`");\r
\r
- foreach($terms AS $term) {\r
- $tag = trim($term["term"], "#");\r
- $tags[] = $tag;\r
+ $server_tags = get_config('system', 'relay_server_tags');\r
+ $tagitems = explode(",", $server_tags);\r
+\r
+ foreach($tagitems AS $tag)\r
+ $tags[trim($tag, "# ")] = trim($tag, "# ");\r
+\r
+ if (get_config('system', 'relay_user_tags')) {\r
+ $terms = q("SELECT DISTINCT(`term`) FROM `search`");\r
+\r
+ foreach($terms AS $term) {\r
+ $tag = trim($term["term"], "#");\r
+ $tags[$tag] = $tag;\r
+ }\r
}\r
}\r
\r
+ $taglist = array();\r
+ foreach($tags AS $tag)\r
+ $taglist[] = $tag;\r
+\r
$relay = array("subscribe" => $subscribe,\r
"scope" => $scope,\r
- "tags" => array_unique($tags));\r
+ "tags" => $taglist);\r
\r
header('Content-type: application/json; charset=utf-8');\r
- echo json_encode($relay, true);\r
+ echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);\r
exit;\r
}\r