]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Xrd.php
Remove direct calls to App->user
[friendica.git] / src / Module / Xrd.php
index be6a3bf9c58519341a917f725d20f19258f91e7c..d2813cc270ae0d39c479bc79e9cb4cd348651aea 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -25,8 +25,8 @@ use Friendica\BaseModule;
 use Friendica\Core\Hook;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
-use Friendica\Database\DBA;
 use Friendica\DI;
+use Friendica\Model\Contact;
 use Friendica\Model\Photo;
 use Friendica\Model\User;
 use Friendica\Protocol\ActivityNamespace;
@@ -40,10 +40,8 @@ class Xrd extends BaseModule
 {
        public static function rawContent(array $parameters = [])
        {
-               $app = DI::app();
-
                // @TODO: Replace with parameter from router
-               if ($app->argv[0] == 'xrd') {
+               if (DI::args()->getArgv()[0] == 'xrd') {
                        if (empty($_GET['uri'])) {
                                return;
                        }
@@ -132,6 +130,25 @@ class Xrd extends BaseModule
                                        'rel'      => 'http://ostatus.org/schema/1.0/subscribe',
                                        'template' => DI::baseUrl()->get() . '/follow?url={uri}',
                                ],
+                               [
+                                       'rel'  => ActivityNamespace::FEED,
+                                       'type' => 'application/atom+xml',
+                                       'href' => $owner['poll'] ?? DI::baseUrl()->get(),
+                               ],
+                               [
+                                       'rel'  => 'salmon',
+                                       'href' => DI::baseUrl()->get() . '/salmon/' . $owner['nickname'],
+                               ],
+                               [
+                                       'rel'  => 'http://microformats.org/profile/hcard',
+                                       'type' => 'text/html',
+                                       'href' => DI::baseUrl()->get() . '/hcard/' . $owner['nickname'],
+                               ],
+                               [
+                                       'rel'  => 'http://joindiaspora.com/seed_location',
+                                       'type' => 'text/html',
+                                       'href' => DI::baseUrl()->get(),
+                               ],
                        ]
                ];
                header('Access-Control-Allow-Origin: *');
@@ -183,7 +200,7 @@ class Xrd extends BaseModule
                                [
                                        'rel'  => 'http://webfinger.net/rel/avatar',
                                        'type' => $avatar['type'],
-                                       'href' => $owner['photo'],
+                                       'href' => Contact::getAvatarUrlForUrl($owner['url'], $owner['uid']),
                                ],
                                [
                                        'rel'  => 'http://joindiaspora.com/seed_location',
@@ -239,7 +256,7 @@ class Xrd extends BaseModule
                        '$hcard_url'   => $baseURL . '/hcard/' . $owner['nickname'],
                        '$atom'        => $owner['poll'],
                        '$poco_url'    => $owner['poco'],
-                       '$photo'       => $owner['photo'],
+                       '$photo'       => Contact::getAvatarUrlForUrl($owner['url'], $owner['uid']),
                        '$type'        => $avatar['type'],
                        '$salmon'      => $baseURL . '/salmon/' . $owner['nickname'],
                        '$salmen'      => $baseURL . '/salmon/' . $owner['nickname'] . '/mention',