kopia lustrzana https://github.com/nextcloud/social
more loggin
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/579/head
rodzic
86a79d7cfc
commit
37dd4f763e
|
@ -36,8 +36,8 @@ use daita\MySmallPhpTools\Traits\TStringTools;
|
|||
use Exception;
|
||||
use OC\AppFramework\Http;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\SignatureIsGoneException;
|
||||
use OCA\Social\Exceptions\ItemUnknownException;
|
||||
use OCA\Social\Exceptions\SignatureIsGoneException;
|
||||
use OCA\Social\Exceptions\UrlCloudException;
|
||||
use OCA\Social\Service\CacheActorService;
|
||||
use OCA\Social\Service\FediverseService;
|
||||
|
|
|
@ -279,21 +279,23 @@ class ACore extends Item implements JsonSerializable {
|
|||
*/
|
||||
public function checkOrigin($id) {
|
||||
$host = parse_url($id, PHP_URL_HOST);
|
||||
if ($this->getRoot()
|
||||
->getOrigin() === $host) {
|
||||
$origin = $this->getRoot()
|
||||
->getOrigin();
|
||||
|
||||
if ($origin === $host) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new InvalidOriginException();
|
||||
throw new InvalidOriginException('ACore::checkOrigin - id: ' . $id . ' - origin: ' . $origin);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* @param string $url
|
||||
*
|
||||
* @throws ActivityCantBeVerifiedException
|
||||
* @deprecated
|
||||
*
|
||||
*/
|
||||
public function verify(string $url) {
|
||||
// TODO - Compare this with checkOrigin() - and delete this method.
|
||||
|
|
|
@ -144,7 +144,9 @@ class CacheActorService {
|
|||
}
|
||||
|
||||
if ($id !== $actor->getId()) {
|
||||
throw new InvalidOriginException();
|
||||
throw new InvalidOriginException(
|
||||
'CacheActorService::getFromId - id: ' . $id . ' - actorId: ' . $actor->getId()
|
||||
);
|
||||
}
|
||||
|
||||
$actor->setAccount($actor->getPreferredUsername() . '@' . $this->get('_host', $object));
|
||||
|
@ -227,8 +229,8 @@ class CacheActorService {
|
|||
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @return int
|
||||
* @throws Exception
|
||||
*/
|
||||
public function missingCacheRemoteActors(): int {
|
||||
// TODO - looking for missing cache remote actors...
|
||||
|
@ -246,8 +248,8 @@ class CacheActorService {
|
|||
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @return int
|
||||
* @throws Exception
|
||||
*/
|
||||
public function manageCacheRemoteActors(): int {
|
||||
$update = $this->cacheActorsRequest->getRemoteActorsToUpdate();
|
||||
|
|
|
@ -175,7 +175,9 @@ class CurlService {
|
|||
}
|
||||
|
||||
if (strtolower($actor->getId()) !== strtolower($id)) {
|
||||
throw new InvalidOriginException();
|
||||
throw new InvalidOriginException(
|
||||
'CurlService::retrieveAccount - id: ' . $id . ' - actorId: ' . $actor->getId()
|
||||
);
|
||||
}
|
||||
|
||||
return $actor;
|
||||
|
|
|
@ -126,7 +126,7 @@ class SignatureService {
|
|||
public function generateKeys(Person &$actor) {
|
||||
$res = openssl_pkey_new(
|
||||
[
|
||||
"digest_alg" => "rsa",
|
||||
"digest_alg" => "rsa",
|
||||
"private_key_bits" => 2048,
|
||||
"private_key_type" => OPENSSL_KEYTYPE_RSA,
|
||||
]
|
||||
|
@ -374,6 +374,10 @@ class SignatureService {
|
|||
|
||||
$entries = explode(',', $signatureHeader);
|
||||
foreach ($entries as $entry) {
|
||||
if ($entry === '' || !strpos($entry, '=')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
list($k, $v) = explode('=', $entry, 2);
|
||||
preg_match('/"([^"]+)"/', $v, $varr);
|
||||
$v = trim($varr[0], '"');
|
||||
|
@ -422,7 +426,9 @@ class SignatureService {
|
|||
return $host;
|
||||
}
|
||||
|
||||
throw new InvalidOriginException();
|
||||
throw new InvalidOriginException(
|
||||
'SignatureService::getKeyOrigin - host: ' . $host . ' - id: ' . $id
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -320,7 +320,10 @@ class StreamQueueService {
|
|||
$object->setOrigin($origin, SignatureService::ORIGIN_REQUEST, time());
|
||||
|
||||
if ($object->getId() !== $item->getUrl()) {
|
||||
throw new InvalidOriginException();
|
||||
throw new InvalidOriginException(
|
||||
'StreamQueueService::cacheItem - objectId: ' . $object->getId() . ' - itemUrl: '
|
||||
. $item->getUrl()
|
||||
);
|
||||
}
|
||||
|
||||
if ($object->getType() !== Note::TYPE) {
|
||||
|
|
Ładowanie…
Reference in New Issue