3 namespace Friendica\Module\WellKnown;
5 use Friendica\BaseModule;
7 use Friendica\Model\Search;
10 * Node subscription preferences for social realy systems
11 * @see https://git.feneas.org/jaywink/social-relay/blob/master/docs/relays.md
13 class XSocialRelay extends BaseModule
15 public static function rawContent(array $parameters = [])
18 $config = $app->getConfig();
20 $subscribe = $config->get('system', 'relay_subscribe', false);
23 $scope = $config->get('system', 'relay_scope', SR_SCOPE_ALL);
25 $scope = SR_SCOPE_NONE;
31 if ($scope == SR_SCOPE_TAGS) {
32 $server_tags = $config->get('system', 'relay_server_tags');
33 $tagitems = explode(',', $server_tags);
35 /// @todo Check if it was better to use "strtolower" on the tags
36 foreach ($tagitems AS $tag) {
37 $systemTags[] = trim($tag, '# ');
40 if ($config->get('system', 'relay_user_tags')) {
41 $userTags = Search::getUserTags();
45 $tagList = array_unique(array_merge($systemTags, $userTags));
48 'subscribe' => $subscribe,
53 'receive' => $app->getBaseURL() . '/receive/public'
56 'receive' => $app->getBaseURL() . '/dfrn_notify'
61 header('Content-type: application/json; charset=utf-8');
62 echo json_encode($relay, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);