Fixed issues with chat authentication.

This commit is contained in:
flash 2022-02-27 17:17:55 +00:00
parent 881426e950
commit ac30c42285
2 changed files with 4 additions and 4 deletions

View file

@ -26,10 +26,10 @@ $router->use('/', function($response) {
});
$router->addErrorHandler(400, function($response) {
$response->setContent(Template::renderRaw('errors.404'));
$response->setContent(Template::renderRaw('errors.400'));
});
$router->addErrorHandler(403, function($response) {
$response->setContent(Template::renderRaw('errors.404'));
$response->setContent(Template::renderRaw('errors.403'));
});
$router->addErrorHandler(404, function($response) {
$response->setContent(Template::renderRaw('errors.404'));

View file

@ -328,8 +328,8 @@ final class SockChatHandler extends Handler {
}
public function verify($response, $request): array {
if(!$request->isStringContent())
return 400;
if(!$request->isStreamContent())
return ['success' => false, 'reason' => 'request'];
$userHash = $request->hasHeader('X-SharpChat-Signature') ? $request->getHeaderFirstLine('X-SharpChat-Signature') : '';