X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FWellKnown%2FXSocialRelay.php;h=bf767a3e7ba0f0d34b5570ab42596a9629dc73e6;hb=69b7923df2beed71419bc38e61ca9755fad24b12;hp=2ddac3836d82b7067329155c7b23d65c236413ff;hpb=1de3f186d79f3703850524c1d58c237be3eb25f3;p=friendica.git diff --git a/src/Module/WellKnown/XSocialRelay.php b/src/Module/WellKnown/XSocialRelay.php index 2ddac3836d..bf767a3e7b 100644 --- a/src/Module/WellKnown/XSocialRelay.php +++ b/src/Module/WellKnown/XSocialRelay.php @@ -1,10 +1,30 @@ . + * + */ namespace Friendica\Module\WellKnown; use Friendica\BaseModule; use Friendica\DI; use Friendica\Model\Search; +use Friendica\Protocol\Relay; /** * Node subscription preferences for social realy systems @@ -12,28 +32,21 @@ use Friendica\Model\Search; */ class XSocialRelay extends BaseModule { - public static function rawContent(array $parameters = []) + protected function rawContent(array $request = []) { - $app = DI::app(); - $config = $app->getConfig(); - - $subscribe = $config->get('system', 'relay_subscribe', false); + $config = DI::config(); - if ($subscribe) { - $scope = $config->get('system', 'relay_scope', SR_SCOPE_ALL); - } else { - $scope = SR_SCOPE_NONE; - } + $scope = $config->get('system', 'relay_scope'); $systemTags = []; $userTags = []; - if ($scope == SR_SCOPE_TAGS) { + 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) { + foreach ($tagitems as $tag) { $systemTags[] = trim($tag, '# '); } @@ -45,19 +58,24 @@ class XSocialRelay extends BaseModule $tagList = array_unique(array_merge($systemTags, $userTags)); $relay = [ - 'subscribe' => $subscribe, + 'subscribe' => ($scope != Relay::SCOPE_NONE), 'scope' => $scope, 'tags' => $tagList, 'protocols' => [ - 'diaspora' => [ - 'receive' => $app->getBaseURL() . '/receive/public' + 'activitypub' => [ + 'actor' => DI::baseUrl()->get() . '/friendica', + 'receive' => DI::baseUrl()->get() . '/inbox' ], 'dfrn' => [ - 'receive' => $app->getBaseURL() . '/dfrn_notify' + 'receive' => DI::baseUrl()->get() . '/dfrn_notify' ] ] ]; + if (DI::config()->get("system", "diaspora_enabled")) { + $relay['protocols']['diaspora'] = ['receive' => DI::baseUrl()->get() . '/receive/public']; + } + header('Content-type: application/json; charset=utf-8'); echo json_encode($relay, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); exit;