. * */ namespace Friendica\Module\WellKnown; use Friendica\BaseModule; use Friendica\Core\System; use Friendica\DI; use Friendica\Model\Search; use Friendica\Protocol\Relay; /** * Node subscription preferences for social realy systems * @see https://git.feneas.org/jaywink/social-relay/blob/master/docs/relays.md */ class XSocialRelay extends BaseModule { protected function rawContent(array $request = []) { $config = DI::config(); $scope = $config->get('system', 'relay_scope'); $systemTags = []; $userTags = []; if ($scope == Relay::SCOPE_TAGS) { $server_tags = $config->get('system', 'relay_server_tags'); $tagitems = explode(',', $server_tags); /// @todo Check if it was better to use "strtolower" on the tags foreach ($tagitems as $tag) { $systemTags[] = trim($tag, '# '); } if ($config->get('system', 'relay_user_tags')) { $userTags = Search::getUserTags(); } } $tagList = array_unique(array_merge($systemTags, $userTags)); $relay = [ 'subscribe' => ($scope != Relay::SCOPE_NONE), 'scope' => $scope, 'tags' => $tagList, 'protocols' => [ 'activitypub' => [ 'actor' => DI::baseUrl()->get() . '/friendica', 'receive' => DI::baseUrl()->get() . '/inbox' ], 'dfrn' => [ 'receive' => DI::baseUrl()->get() . '/dfrn_notify' ] ] ]; if (DI::config()->get("system", "diaspora_enabled")) { $relay['protocols']['diaspora'] = ['receive' => DI::baseUrl()->get() . '/receive/public']; } System::jsonExit($relay); } }