3 namespace Friendica\Module\WellKnown;
5 use Friendica\BaseModule;
6 use Friendica\Model\Search;
9 * Node subscription preferences for social realy systems
10 * @see https://git.feneas.org/jaywink/social-relay/blob/master/docs/relays.md
12 class XSocialRelay extends BaseModule
14 public static function rawContent(array $parameters = [])
16 $app = self::getApp();
17 $config = $app->getConfig();
19 $subscribe = $config->get('system', 'relay_subscribe', false);
22 $scope = $config->get('system', 'relay_scope', SR_SCOPE_ALL);
24 $scope = SR_SCOPE_NONE;
30 if ($scope == SR_SCOPE_TAGS) {
31 $server_tags = $config->get('system', 'relay_server_tags');
32 $tagitems = explode(',', $server_tags);
34 /// @todo Check if it was better to use "strtolower" on the tags
35 foreach ($tagitems AS $tag) {
36 $systemTags[] = trim($tag, '# ');
39 if ($config->get('system', 'relay_user_tags')) {
40 $userTags = Search::getUserTags();
44 $tagList = array_unique(array_merge($systemTags, $userTags));
47 'subscribe' => $subscribe,
52 'receive' => $app->getBaseURL() . '/receive/public'
55 'receive' => $app->getBaseURL() . '/dfrn_notify'
60 header('Content-type: application/json; charset=utf-8');
61 echo json_encode($relay, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);