use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Post;
+use Friendica\Model\User;
use Friendica\Network\HTTPException;
use Friendica\Protocol\ActivityPub;
-use Friendica\Security\PermissionSet\Repository\PermissionSet;
use Friendica\Util\HTTPSignature;
use Friendica\Util\Network;
use Friendica\Util\Strings;
throw new HTTPException\NotFoundException();
}
- $validated = in_array($item['private'], [Item::PUBLIC, Item::UNLISTED]);
+ $owner = User::getById($item['uid'], ['hidewall']);
+
+ $validated = empty($owner['hidewall']) && in_array($item['private'], [Item::PUBLIC, Item::UNLISTED]);
if (!$validated) {
$requester = HTTPSignature::getSigner('', $_SERVER);
if (!empty($requester)) {
$receivers = Item::enumeratePermissions($item, false);
+ $receivers[] = $item['contact-id'];
$validated = in_array(Contact::getIdForURL($requester, $item['uid']), $receivers);
if (!$validated) {
$last_modified = $item['changed'];
Network::checkEtagModified($etag, $last_modified);
- if (empty($this->parameters['activity']) && ($item['gravity'] != GRAVITY_ACTIVITY)) {
- $activity = ActivityPub\Transmitter::createActivityFromItem($item['id'], true);
+ if (empty($this->parameters['activity']) && ($item['gravity'] != Item::GRAVITY_ACTIVITY)) {
+ $activity = ActivityPub\Transmitter::createCachedActivityFromItem($item['id'], false, true);
if (empty($activity['type'])) {
throw new HTTPException\NotFoundException();
}
} elseif (empty($this->parameters['activity']) || in_array($this->parameters['activity'],
['Create', 'Announce', 'Update', 'Like', 'Dislike', 'Accept', 'Reject',
'TentativeAccept', 'Follow', 'Add'])) {
- $data = ActivityPub\Transmitter::createActivityFromItem($item['id']);
+ $data = ActivityPub\Transmitter::createCachedActivityFromItem($item['id']);
if (empty($data)) {
throw new HTTPException\NotFoundException();
}
// Relaxed CORS header for public items
header('Access-Control-Allow-Origin: *');
+
System::jsonExit($data, 'application/activity+json');
}
}