Replace header()
with $response->setHeader()
at BaseModule
This commit is contained in:
parent
78c45bd142
commit
3b2946f98f
|
@ -175,26 +175,26 @@ abstract class BaseModule implements ICanHandleRequests
|
||||||
{
|
{
|
||||||
// @see https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb
|
// @see https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb
|
||||||
if (substr($request['pagename'] ?? '', 0, 12) == '.well-known/') {
|
if (substr($request['pagename'] ?? '', 0, 12) == '.well-known/') {
|
||||||
header('Access-Control-Allow-Origin: *');
|
$this->response->setHeader('*', 'Access-Control-Allow-Origin');
|
||||||
header('Access-Control-Allow-Headers: *');
|
$this->response->setHeader('*', 'Access-Control-Allow-Headers');
|
||||||
header('Access-Control-Allow-Methods: ' . Router::GET);
|
$this->response->setHeader(Router::GET, 'Access-Control-Allow-Methods');
|
||||||
header('Access-Control-Allow-Credentials: false');
|
$this->response->setHeader('false', 'Access-Control-Allow-Credentials');
|
||||||
} elseif (substr($request['pagename'] ?? '', 0, 8) == 'profile/') {
|
} elseif (substr($request['pagename'] ?? '', 0, 8) == 'profile/') {
|
||||||
header('Access-Control-Allow-Origin: *');
|
$this->response->setHeader('*', 'Access-Control-Allow-Origin');
|
||||||
header('Access-Control-Allow-Headers: *');
|
$this->response->setHeader('*', 'Access-Control-Allow-Headers');
|
||||||
header('Access-Control-Allow-Methods: ' . Router::GET);
|
$this->response->setHeader(Router::GET, 'Access-Control-Allow-Methods');
|
||||||
header('Access-Control-Allow-Credentials: false');
|
$this->response->setHeader('false', 'Access-Control-Allow-Credentials');
|
||||||
} elseif (substr($request['pagename'] ?? '', 0, 4) == 'api/') {
|
} elseif (substr($request['pagename'] ?? '', 0, 4) == 'api/') {
|
||||||
header('Access-Control-Allow-Origin: *');
|
$this->response->setHeader('*', 'Access-Control-Allow-Origin');
|
||||||
header('Access-Control-Allow-Headers: *');
|
$this->response->setHeader('*', 'Access-Control-Allow-Headers');
|
||||||
header('Access-Control-Allow-Methods: ' . implode(',', Router::ALLOWED_METHODS));
|
$this->response->setHeader(implode(',', Router::ALLOWED_METHODS), 'Access-Control-Allow-Methods');
|
||||||
header('Access-Control-Allow-Credentials: false');
|
$this->response->setHeader('false', 'Access-Control-Allow-Credentials');
|
||||||
header('Access-Control-Expose-Headers: Link');
|
$this->response->setHeader('Link', 'Access-Control-Expose-Headers');
|
||||||
} elseif (substr($request['pagename'] ?? '', 0, 11) == 'oauth/token') {
|
} elseif (substr($request['pagename'] ?? '', 0, 11) == 'oauth/token') {
|
||||||
header('Access-Control-Allow-Origin: *');
|
$this->response->setHeader('*', 'Access-Control-Allow-Origin');
|
||||||
header('Access-Control-Allow-Headers: *');
|
$this->response->setHeader('*', 'Access-Control-Allow-Headers');
|
||||||
header('Access-Control-Allow-Methods: ' . Router::POST);
|
$this->response->setHeader(Router::POST, 'Access-Control-Allow-Methods');
|
||||||
header('Access-Control-Allow-Credentials: false');
|
$this->response->setHeader('false', 'Access-Control-Allow-Credentials');
|
||||||
}
|
}
|
||||||
|
|
||||||
$placeholder = '';
|
$placeholder = '';
|
||||||
|
|
Loading…
Reference in a new issue