]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/NoScrape.php
Preview for Videos and images / Video resolution selection
[friendica.git] / src / Module / NoScrape.php
index 13a683d974868b53b9f18812de5d884df1d7840e..8f799aa966150dbeacaa626bc0e52bd05b575abf 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
  *
@@ -26,14 +26,13 @@ use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\DI;
-use Friendica\Model\GContact;
 use Friendica\Model\Profile;
 use Friendica\Model\User;
 
 /**
  * Endpoint for getting current user infos
  *
- * @see GContact::updateFromNoScrape() for usage
+ * @see Contact::updateFromNoScrape() for usage
  */
 class NoScrape extends BaseModule
 {
@@ -46,19 +45,22 @@ class NoScrape extends BaseModule
                        $which = $parameters['nick'];
                } elseif (local_user() && isset($parameters['profile']) && DI::args()->get(2) == 'view') {
                        // view infos about a known profile (needs a login)
-                       $which   = $a->user['nickname'];
+                       $which = $a->user['nickname'];
                } else {
                        System::jsonError(403, 'Authentication required');
-                       exit();
                }
 
                Profile::load($a, $which);
 
+               if (empty($a->profile['uid'])) {
+                       System::jsonError(404, 'Profile not found');
+               }
+
                $json_info = [
                        'addr'         => $a->profile['addr'],
                        'nick'         => $which,
                        'guid'         => $a->profile['guid'],
-                       'key'          => $a->profile['pubkey'],
+                       'key'          => $a->profile['upubkey'],
                        'homepage'     => DI::baseUrl() . "/profile/{$which}",
                        'comm'         => ($a->profile['account-type'] == User::ACCOUNT_TYPE_COMMUNITY),
                        'account-type' => $a->profile['account-type'],