Make requested changes
This commit is contained in:
parent
6a5266c6b8
commit
40783db161
|
@ -46,6 +46,8 @@ class Objects extends BaseModule
|
|||
throw new HTTPException\BadRequestException();
|
||||
}
|
||||
|
||||
header('Vary: Accept', false);
|
||||
|
||||
if (!ActivityPub::isRequest()) {
|
||||
DI::baseUrl()->redirect(str_replace('objects/', 'display/', DI::args()->getQueryString()));
|
||||
}
|
||||
|
@ -130,8 +132,6 @@ class Objects extends BaseModule
|
|||
// Relaxed CORS header for public items
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
header('Vary: Accept', false);
|
||||
|
||||
System::jsonExit($data, 'application/activity+json');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,8 +90,6 @@ class Friendica extends BaseModule
|
|||
$blocked = null;
|
||||
}
|
||||
|
||||
header('Vary: Accept', false);
|
||||
|
||||
$hooked = '';
|
||||
|
||||
Hook::callAll('about_hook', $hooked);
|
||||
|
@ -117,6 +115,8 @@ class Friendica extends BaseModule
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
header('Vary: Accept', false);
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (DI::args()->getArgc() <= 1 || (DI::args()->getArgv()[1] !== 'json')) {
|
||||
if (!ActivityPub::isRequest()) {
|
||||
|
@ -127,7 +127,6 @@ class Friendica extends BaseModule
|
|||
$data = ActivityPub\Transmitter::getProfile(0);
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Cache-Control: max-age=23200, stale-while-revalidate=23200');
|
||||
header('Vary: Accept', false);
|
||||
System::jsonExit($data, 'application/activity+json');
|
||||
} catch (HTTPException\NotFoundException $e) {
|
||||
System::jsonError(404, ['error' => 'Record not found']);
|
||||
|
|
|
@ -88,6 +88,8 @@ class Display extends BaseModule
|
|||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
header('Vary: Accept', false);
|
||||
|
||||
if (ActivityPub::isRequest()) {
|
||||
$this->baseUrl->redirect(str_replace('display/', 'objects/', $this->args->getQueryString()));
|
||||
}
|
||||
|
@ -162,8 +164,6 @@ class Display extends BaseModule
|
|||
|
||||
$output .= $this->getDisplayData($item);
|
||||
|
||||
header('Vary: Accept', false);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,8 @@ class Profile extends BaseProfile
|
|||
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
header('Vary: Accept', false);
|
||||
|
||||
if (ActivityPub::isRequest()) {
|
||||
$user = $this->database->selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname'] ?? '', 'account_removed' => false]);
|
||||
if ($user) {
|
||||
|
@ -87,7 +89,6 @@ class Profile extends BaseProfile
|
|||
$data = ActivityPub\Transmitter::getProfile($user['uid']);
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Cache-Control: max-age=23200, stale-while-revalidate=23200');
|
||||
header('Vary: Accept', false);
|
||||
System::jsonExit($data, 'application/activity+json');
|
||||
} catch (HTTPException\NotFoundException $e) {
|
||||
System::jsonError(404, ['error' => 'Record not found']);
|
||||
|
@ -104,8 +105,6 @@ class Profile extends BaseProfile
|
|||
System::jsonError(404, []);
|
||||
}
|
||||
}
|
||||
|
||||
header('Vary: Accept', false);
|
||||
}
|
||||
|
||||
protected function content(array $request = []): string
|
||||
|
|
|
@ -80,6 +80,8 @@ class Xrd extends BaseModule
|
|||
throw new NotFoundException('Invalid host name for xrd query: ' . $host);
|
||||
}
|
||||
|
||||
header('Vary: Accept', false);
|
||||
|
||||
if ($name == User::getActorName()) {
|
||||
$owner = User::getSystemAccount();
|
||||
if (empty($owner)) {
|
||||
|
@ -152,7 +154,6 @@ class Xrd extends BaseModule
|
|||
]
|
||||
];
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Vary: Accept', false);
|
||||
System::jsonExit($json, 'application/jrd+json; charset=utf-8');
|
||||
}
|
||||
|
||||
|
@ -230,7 +231,6 @@ class Xrd extends BaseModule
|
|||
];
|
||||
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Vary: Accept', false);
|
||||
System::jsonExit($json, 'application/jrd+json; charset=utf-8');
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,6 @@ class Xrd extends BaseModule
|
|||
]);
|
||||
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Vary: Accept', false);
|
||||
System::httpExit($xmlString, Response::TYPE_XML, 'application/xrd+xml');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user