Issue 15006: Fix processing incoming Peertube posts

pull/15062/head
Michael 2025-08-02 18:34:32 +00:00
rodzic 4c91c08e3c
commit 2ba9cad506
2 zmienionych plików z 21 dodań i 2 usunięć

Wyświetl plik

@ -169,6 +169,22 @@ class Queue
return DBA::exists('workerqueue', ['id' => $wid, 'done' => false]);
}
/**
* Process a queue entry by its URI and type.
*
* @param string $url The URI of the activity (e.g., 'https://example.com/activity/123')
* @param string $type Type of the activity (e.g., 'as:Create', 'as:Follow')
* @return boolean
*/
public static function processByUri(string $url, string $type): bool
{
$entry = DBA::selectFirst('inbox-entry', ['id'], ['object-id' => $url, 'type' => $type]);
if (empty($entry['id'])) {
return false;
}
return self::process($entry['id'], false);
}
/**
* Process the activity with the given id
*

Wyświetl plik

@ -114,10 +114,10 @@ class Receiver
DI::logger()->notice('Invalid HTTP signature, message will not be trusted.', ['uid' => $uid, 'actor' => $actor, 'header' => $header, 'body' => $body]);
$signer = [];
} elseif (empty($http_signer)) {
DI::logger()->info('Signer is a tombstone. The message will be discarded, the signer account is deleted.');
DI::logger()->info('Signer is a tombstone. The message will be discarded, the signer account is deleted.', ['uid' => $uid, 'actor' => $actor]);
return;
} else {
DI::logger()->info('Valid HTTP signature', ['signer' => $http_signer]);
DI::logger()->info('Valid HTTP signature', ['uid' => $uid, 'actor' => $actor, 'signer' => $http_signer]);
$signer = [$http_signer];
}
@ -838,6 +838,9 @@ class Receiver
Queue::remove($object_data);
return true;
}
} elseif (Queue::exists($object_data['object_id'], 'as:Create')) {
DI::logger()->info('Announced id will now be processed.', ['uid' => $uid, 'id' => $object_data['object_id']]);
Queue::processByUri($object_data['object_id'], 'as:Create');
} else {
DI::logger()->info('Announced id already exists', ['uid' => $uid, 'id' => $object_data['object_id']]);
Queue::remove($object_data);