Add cache and CORS headers to ActivityPub endpoints
This commit is contained in:
parent
1e32f74b0b
commit
af817b2ad5
|
@ -76,6 +76,8 @@ class Objects extends BaseModule
|
|||
$data = ['@context' => ActivityPub::CONTEXT];
|
||||
$data = array_merge($data, $activity['object']);
|
||||
|
||||
// Relaxed CORS header for public items
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
System::jsonExit($data, 'application/activity+json');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@ class Profile extends BaseProfile
|
|||
// The function returns an empty array when the account is removed, expired or blocked
|
||||
$data = ActivityPub\Transmitter::getProfile($user['uid']);
|
||||
if (!empty($data)) {
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Cache-Control: max-age=23200, stale-while-revalidate=23200');
|
||||
System::jsonExit($data, 'application/activity+json');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue