Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/modules/Smtp/Interfaces/TCP/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Spiral\Cqrs\CommandBusInterface;
use Spiral\RoadRunner\Tcp\Request;
use Spiral\RoadRunner\Tcp\TcpEvent;
use Spiral\RoadRunner\Tcp\TcpResponse;
use Spiral\RoadRunnerBridge\Tcp\Response\CloseConnection;
use Spiral\RoadRunnerBridge\Tcp\Response\RespondMessage;
use Spiral\RoadRunnerBridge\Tcp\Response\ResponseInterface;
Expand Down Expand Up @@ -45,6 +46,7 @@ public function handle(Request $request): ResponseInterface
$message = $this->cache->get($cacheKey, []);

$response = new CloseConnection();
$dispatched = false;

if ($request->event === TcpEvent::Close) {
$this->cache->delete($cacheKey);
Expand All @@ -71,15 +73,26 @@ public function handle(Request $request): ResponseInterface
if (\count($messages) === 1) {
$this->dispatchMessage($content);
$this->cache->delete($cacheKey);
$dispatched = true;
} elseif (!empty($messages[1])) {
$this->dispatchMessage($messages[0]);
$this->cache->delete($cacheKey);
$dispatched = true;
}
}

$message['content'] = $content;
}

if (
$response instanceof CloseConnection ||
$response->getAction() === TcpResponse::RespondClose ||
$dispatched
) {
$this->cache->delete($cacheKey);
return $response;
}

$this->cache->set(
$cacheKey,
$message,
Expand Down
6 changes: 0 additions & 6 deletions app/src/Application/OAuth/ActorProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@

namespace App\Application\OAuth;

use Auth0\SDK\Auth0;
use Spiral\Auth\ActorProviderInterface;
use Spiral\Auth\TokenInterface;

final class ActorProvider implements ActorProviderInterface
{
public function __construct(
private readonly Auth0 $auth,
) {
}

public function getActor(TokenInterface $token): ?User
{
$payload = $token->getPayload();
Expand Down
12 changes: 9 additions & 3 deletions app/src/Interfaces/Centrifugo/RPCService.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,16 @@ public function createHttpRequest(Request\RPC $request): ServerRequestInterface
$token = $data['token'] ?? null;
unset($data['token']);

return match ($method) {
'GET', 'HEAD' => $httpRequest->withQueryParams($data)->withHeader('X-Auth-Token', $token),
'POST', 'PUT', 'DELETE' => $httpRequest->withParsedBody($data)->withHeader('X-Auth-Token', $token),
$httpRequest = match ($method) {
'GET', 'HEAD' => $httpRequest->withQueryParams($data),
'POST', 'PUT', 'DELETE' => $httpRequest->withParsedBody($data),
default => throw new \InvalidArgumentException('Unsupported method'),
};

if (!empty($token)) {
$httpRequest = $httpRequest->withHeader('X-Auth-Token', $token);
}

return $httpRequest;
}
}
5 changes: 4 additions & 1 deletion app/src/Interfaces/Http/Handler/FrontendRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ private function isValidRequest(ServerRequestInterface $request): bool
{
$path = $request->getUri()->getPath();

return $path === '/' || \str_starts_with($path, '/_nuxt/') || $path === '/favicon/favicon.ico';
return $path === '/'
|| \str_starts_with($path, '/_nuxt/')
|| $path === '/favicon/favicon.ico'
|| $path === '/bg.jpg';
}
}
2 changes: 2 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ ENV APP_ENV=production
ENV DEBUG=false
ENV ENCRYPTER_KEY=def00000232ae92c8e8ec0699093fa06ce014cd48d39c3c62c279dd947db084e56ee48b5c91cebc1c5abe53f7755021d09043757561c244c1c0c765cfeb5db33eb45a903
ENV TOKENIZER_CACHE_TARGETS=true
ENV AUTH_TOKEN_STORAGE=jwt
ENV AUTH_TOKEN_TRANSPORT=header

LABEL org.opencontainers.image.source=$REPOSITORY
LABEL org.opencontainers.image.description="Buggregator"
Expand Down