mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-06 18:31:05 +00:00
fix(activity-pub): cache issues when navigating to activity stream urls
This commit is contained in:
parent
e5b7515023
commit
7bcbfb32f7
@ -48,7 +48,10 @@ class ActorController extends Controller
|
|||||||
return $this->{$method}(...$params);
|
return $this->{$method}(...$params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index(): RedirectResponse
|
/**
|
||||||
|
* @noRector ReturnTypeDeclarationRector
|
||||||
|
*/
|
||||||
|
public function index(): ResponseInterface
|
||||||
{
|
{
|
||||||
$actorObjectClass = $this->config->actorObject;
|
$actorObjectClass = $this->config->actorObject;
|
||||||
$actorObject = new $actorObjectClass($this->actor);
|
$actorObject = new $actorObjectClass($this->actor);
|
||||||
@ -60,6 +63,8 @@ class ActorController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles incoming requests from fediverse servers
|
* Handles incoming requests from fediverse servers
|
||||||
|
*
|
||||||
|
* @noRector ReturnTypeDeclarationRector
|
||||||
*/
|
*/
|
||||||
public function inbox(): ResponseInterface
|
public function inbox(): ResponseInterface
|
||||||
{
|
{
|
||||||
@ -228,7 +233,10 @@ class ActorController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function outbox(): RedirectResponse
|
/**
|
||||||
|
* @noRector ReturnTypeDeclarationRector
|
||||||
|
*/
|
||||||
|
public function outbox(): ResponseInterface
|
||||||
{
|
{
|
||||||
// get published activities by publication date
|
// get published activities by publication date
|
||||||
$actorActivity = model('ActivityModel')
|
$actorActivity = model('ActivityModel')
|
||||||
@ -257,7 +265,10 @@ class ActorController extends Controller
|
|||||||
->setBody($collection->toJSON());
|
->setBody($collection->toJSON());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function followers(): RedirectResponse
|
/**
|
||||||
|
* @noRector ReturnTypeDeclarationRector
|
||||||
|
*/
|
||||||
|
public function followers(): ResponseInterface
|
||||||
{
|
{
|
||||||
// get followers for a specific actor
|
// get followers for a specific actor
|
||||||
$followers = model('ActorModel')
|
$followers = model('ActorModel')
|
||||||
@ -334,7 +345,10 @@ class ActorController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function activity(string $activityId): RedirectResponse
|
/**
|
||||||
|
* @noRector ReturnTypeDeclarationRector
|
||||||
|
*/
|
||||||
|
public function activity(string $activityId): ResponseInterface
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
! ($activity = model('ActivityModel')->getActivityById($activityId))
|
! ($activity = model('ActivityModel')->getActivityById($activityId))
|
||||||
|
@ -33,7 +33,7 @@ class ObjectType extends AbstractObject
|
|||||||
protected array $to = ['https://www.w3.org/ns/activitystreams#Public'];
|
protected array $to = ['https://www.w3.org/ns/activitystreams#Public'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var string[]|null
|
||||||
*/
|
*/
|
||||||
protected array $cc = [];
|
protected ?array $cc = null;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,10 @@ class ActorModel extends Model
|
|||||||
$domain = get_current_domain();
|
$domain = get_current_domain();
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheName = "actor-{$username}-{$domain}";
|
// remove colons for port if set
|
||||||
|
$cacheDomain = str_replace(':', '', $domain);
|
||||||
|
|
||||||
|
$cacheName = "actor-{$username}-{$cacheDomain}";
|
||||||
if (! ($found = cache($cacheName))) {
|
if (! ($found = cache($cacheName))) {
|
||||||
$found = $this->where([
|
$found = $this->where([
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user