mirror of
https://github.com/friendica/friendica
synced 2025-05-01 19:04:23 +02:00
APContact stuff is moved to an own class
This commit is contained in:
parent
f3814ae1fc
commit
9ec30010c5
4 changed files with 197 additions and 193 deletions
|
@ -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']];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue