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()
18 $app = self::getApp();
19 $config = $app->getConfig();
21 $subscribe = $config->get('system', 'relay_subscribe', false);
24 $scope = $config->get('system', 'relay_scope', SR_SCOPE_ALL);
26 $scope = SR_SCOPE_NONE;
32 if ($scope == SR_SCOPE_TAGS) {
33 $server_tags = $config->get('system', 'relay_server_tags');
34 $tagitems = explode(",", $server_tags);
36 /// @todo Check if it was better to use "strtolower" on the tags
37 foreach ($tagitems AS $tag) {
38 $systemTags[] = trim($tag, "# ");
41 if ($config->get('system', 'relay_user_tags')) {
42 $userTags = Search::getUserTags();
46 $tagList = array_unique(array_merge($systemTags, $userTags));
49 'subscribe' => $subscribe,
52 'protocols' => ['diaspora' =>
53 ['receive' => $app->getBaseURL() . '/receive/public'],
55 ['receive' => $app->getBaseURL() . '/dfrn_notify']]
58 header('Content-type: application/json; charset=utf-8');
59 echo json_encode($relay, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);