<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Model\Post;
use Friendica\Network\HTTPException;
use Friendica\Protocol\ActivityPub;
-use Friendica\Protocol\ActivityPub\PageCache;
use Friendica\Util\HTTPSignature;
use Friendica\Util\Network;
use Friendica\Util\Strings;
DI::baseUrl()->redirect(str_replace('objects/', 'display/', DI::args()->getQueryString()));
}
- $data = PageCache::fetch($_SERVER['REQUEST_URI']);
- if (!empty($data)) {
- header('Access-Control-Allow-Origin: *');
-
- System::jsonExit($data, 'application/activity+json');
- }
-
$itemuri = DBA::selectFirst('item-uri', ['id'], ['guid' => $this->parameters['guid']]);
if (DBA::isResult($itemuri)) {
Logger::info('Provided GUID found.', ['guid' => $this->parameters['guid'], 'uri-id' => $itemuri['id']]);
} else {
// The item URI does not always contain the GUID. This means that we have to search the URL instead
- $url = DI::baseUrl()->get() . '/' . DI::args()->getQueryString();
+ $url = DI::baseUrl() . '/' . DI::args()->getQueryString();
$nurl = Strings::normaliseLink($url);
$ssl_url = str_replace('http://', 'https://', $nurl);
$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();
}
throw new HTTPException\NotFoundException();
}
- if (in_array($item['private'], [Item::PUBLIC, Item::UNLISTED])) {
- PageCache::add($_SERVER['REQUEST_URI'], $data);
- }
-
// Relaxed CORS header for public items
header('Access-Control-Allow-Origin: *');