APContact stuff is moved to an own class

This commit is contained in:
Michael 2018-09-26 17:24:29 +00:00
parent f3814ae1fc
commit 9ec30010c5
4 changed files with 197 additions and 193 deletions

View file

@ -9,6 +9,7 @@ use Friendica\BaseObject;
use Friendica\Core\Config;
use Friendica\Database\DBA;
use Friendica\Model\User;
use Friendica\Model\APContact;
use Friendica\Protocol\ActivityPub;
/**
@ -393,12 +394,12 @@ class HTTPSignature
{
$url = (strpos($id, '#') ? substr($id, 0, strpos($id, '#')) : $id);
$profile = ActivityPub::fetchprofile($url);
$profile = APContact::getProfileByURL($url);
if (!empty($profile)) {
logger('Taking key from id ' . $id, LOGGER_DEBUG);
return ['url' => $url, 'pubkey' => $profile['pubkey']];
} elseif ($url != $actor) {
$profile = ActivityPub::fetchprofile($actor);
$profile = APContact::getProfileByURL($actor);
if (!empty($profile)) {
logger('Taking key from actor ' . $actor, LOGGER_DEBUG);
return ['url' => $actor, 'pubkey' => $profile['pubkey']];

View file

@ -5,6 +5,7 @@ namespace Friendica\Util;
use Friendica\Util\JsonLD;
use Friendica\Util\DateTimeFormat;
use Friendica\Protocol\ActivityPub;
use Friendica\Model\APContact;
/**
* @brief Implements JSON-LD signatures
@ -24,30 +25,12 @@ class LDSignature
return false;
}
/*
$creator = $data['signature']['creator'];
$actor = JsonLD::fetchElement($data, 'actor', 'id');
$url = (strpos($creator, '#') ? substr($creator, 0, strpos($creator, '#')) : $creator);
$profile = ActivityPub::fetchprofile($url);
if (!empty($profile)) {
logger('Taking key from creator ' . $creator, LOGGER_DEBUG);
} elseif ($url != $actor) {
$profile = ActivityPub::fetchprofile($actor);
if (empty($profile)) {
return false;
}
logger('Taking key from actor ' . $actor, LOGGER_DEBUG);
}
*/
$actor = JsonLD::fetchElement($data, 'actor', 'id');
if (empty($actor)) {
return false;
}
$profile = ActivityPub::fetchprofile($actor);
$profile = APContact::getProfileByURL($actor);
if (empty($profile['pubkey'])) {
return false;
}