first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace Common\SSR;
use Common\ServerTiming\ServerTiming;
use Exception;
use Illuminate\Support\Facades\Http;
class RenderPageWithNode
{
public function execute(array $bootstrapData): ?string
{
if (
!config('common.site.ssr_enabled') ||
request('appearanceEditor') === 'true'
) {
return null;
}
$serverUrl = config('common.site.ssr_url') . '/render';
try {
app(ServerTiming::class)->start('SSR');
$response = Http::withHeaders([
'Accept-encoding' => 'gzip',
])
->post($serverUrl, [
'bootstrapData' => $bootstrapData,
'url' => request()->getRequestUri(),
])
->throw()
->body();
app(ServerTiming::class)->stop('SSR');
} catch (Exception $e) {
return null;
}
if (is_null($response)) {
return null;
}
return $response;
}
}