mirror of
https://github.com/friendica/friendica
synced 2025-04-28 15:04:26 +02:00
Move .well-known, webfinger, xrd to src/Module/
This commit is contained in:
parent
e7f8d8c3b6
commit
90248f6bb7
10 changed files with 358 additions and 275 deletions
62
src/Module/WellKnown/XSocialRelay.php
Normal file
62
src/Module/WellKnown/XSocialRelay.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Module\WellKnown;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Model\Search;
|
||||
|
||||
/**
|
||||
* Node subscription preferences for social realy systems
|
||||
* @see https://git.feneas.org/jaywink/social-relay/blob/master/docs/relays.md
|
||||
*/
|
||||
class XSocialRelay extends BaseModule
|
||||
{
|
||||
public static function rawContent()
|
||||
{
|
||||
parent::rawContent();
|
||||
|
||||
$app = self::getApp();
|
||||
$config = $app->getConfig();
|
||||
|
||||
$subscribe = $config->get('system', 'relay_subscribe', false);
|
||||
|
||||
if ($subscribe) {
|
||||
$scope = $config->get('system', 'relay_scope', SR_SCOPE_ALL);
|
||||
} else {
|
||||
$scope = SR_SCOPE_NONE;
|
||||
}
|
||||
|
||||
$systemTags = [];
|
||||
$userTags = [];
|
||||
|
||||
if ($scope == SR_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' => $subscribe,
|
||||
'scope' => $scope,
|
||||
'tags' => $tagList,
|
||||
'protocols' => ['diaspora' =>
|
||||
['receive' => $app->getBaseURL() . '/receive/public'],
|
||||
'dfrn' =>
|
||||
['receive' => $app->getBaseURL() . '/dfrn_notify']]
|
||||
];
|
||||
|
||||
header('Content-type: application/json; charset=utf-8');
|
||||
echo json_encode($relay, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue