Merge pull request #5842 from annando/ap-distribution
Improved AP distribution / Only process trusted content
This commit is contained in:
commit
2341ce353d
3 changed files with 14 additions and 1 deletions
|
@ -208,6 +208,7 @@ class Receiver
|
||||||
|
|
||||||
if (!$trust_source) {
|
if (!$trust_source) {
|
||||||
logger('No trust for activity type "' . $activity['type'] . '", so we quit now.', LOGGER_DEBUG);
|
logger('No trust for activity type "' . $activity['type'] . '", so we quit now.', LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($activity['type']) {
|
switch ($activity['type']) {
|
||||||
|
|
|
@ -773,7 +773,7 @@ class Transmitter
|
||||||
$data['context'] = self::fetchContextURLForItem($item);
|
$data['context'] = self::fetchContextURLForItem($item);
|
||||||
|
|
||||||
if (!empty($item['title'])) {
|
if (!empty($item['title'])) {
|
||||||
$data['name'] = BBCode::convert($item['title'], false, 7);
|
$data['name'] = BBCode::toPlaintext($item['title'], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$body = $item['body'];
|
$body = $item['body'];
|
||||||
|
|
|
@ -20,6 +20,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Protocol\Salmon;
|
use Friendica\Protocol\Salmon;
|
||||||
|
use Friendica\Model\Conversation;
|
||||||
|
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
@ -514,6 +515,12 @@ class Notifier
|
||||||
|
|
||||||
if ($target_item['origin']) {
|
if ($target_item['origin']) {
|
||||||
$inboxes = ActivityPub\Transmitter::fetchTargetInboxes($target_item, $uid);
|
$inboxes = ActivityPub\Transmitter::fetchTargetInboxes($target_item, $uid);
|
||||||
|
logger('Origin item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', LOGGER_DEBUG);
|
||||||
|
} elseif (!DBA::exists('conversation', ['item-uri' => $target_item['uri'], 'protocol' => Conversation::PARCEL_ACTIVITYPUB])) {
|
||||||
|
logger('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' is no AP post. It will not be distributed.', LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
logger('Remote item ' . $item_id . ' with URL ' . $target_item['uri'] . ' will be distributed.', LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($parent['origin']) {
|
if ($parent['origin']) {
|
||||||
|
@ -521,6 +528,11 @@ class Notifier
|
||||||
$inboxes = array_merge($inboxes, $parent_inboxes);
|
$inboxes = array_merge($inboxes, $parent_inboxes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($inboxes)) {
|
||||||
|
logger('No inboxes found for item ' . $item_id . ' with URL ' . $target_item['uri'] . '. It will not be distributed.', LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Fill the item cache
|
// Fill the item cache
|
||||||
ActivityPub\Transmitter::createCachedActivityFromItem($item_id);
|
ActivityPub\Transmitter::createCachedActivityFromItem($item_id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue