ActivityPub: Fix Content-type again

This commit is contained in:
veselcraft 2022-01-06 15:37:40 +03:00
parent 0a8b771af4
commit 624a2c088c
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
3 changed files with 5 additions and 3 deletions

View file

@ -255,11 +255,11 @@ abstract class OpenVKPresenter extends SimplePresenter
}
}
protected function returnJson(array $json): void
protected function returnJson(array $json, string $ct = "application/json"): void
{
$payload = json_encode($json, JSON_UNESCAPED_UNICODE);
$size = strlen($payload);
header("Content-Type: application/json");
header("Content-Type: " . $ct);
header("Content-Length: $size");
exit($payload);
}

View file

@ -71,7 +71,7 @@ final class UserPresenter extends OpenVKPresenter
);
}
$this->returnJson($objUser);
$this->returnJson($objUser, CT_AP);
}
if($user->getShortCode())

View file

@ -240,6 +240,8 @@ return (function() {
define('MONTH', 30 * DAY);
define('YEAR', 365 * DAY);
define('CT_AP', 'application/activity+json'); // Content-type of ActivityPub protocol
define("nullptr", NULL);
define("OPENVK_DEFAULT_INSTANCE_NAME", "OpenVK", false);
define("OPENVK_VERSION", "Altair Preview ($ver)", false);