Update
This commit is contained in:
@@ -44,7 +44,7 @@ public function takeScreenshot(string $url, array $options = []): array
|
||||
private function configureBrowsershot(string $url, array $options = []): Browsershot
|
||||
{
|
||||
$browsershot = Browsershot::url($url)
|
||||
->waitUntilNetworkIdle()
|
||||
->waitUntilNetworkIdle() // Always enabled for production to ensure proper rendering
|
||||
->preventUnsuccessfulResponse();
|
||||
|
||||
|
||||
@@ -52,18 +52,17 @@ private function configureBrowsershot(string $url, array $options = []): Browser
|
||||
$browsershot->noSandbox();
|
||||
}
|
||||
|
||||
// Basic configuration
|
||||
if (isset($options['timeout'])) {
|
||||
$browsershot->timeout($options['timeout']);
|
||||
}
|
||||
// Basic configuration with maximum timeout safeguard
|
||||
$timeout = $options['timeout'] ?? 30;
|
||||
$maxTimeout = 300; // 5 minutes maximum to prevent indefinite waiting
|
||||
$browsershot->timeout(min($timeout, $maxTimeout));
|
||||
|
||||
if (isset($options['delay'])) {
|
||||
$browsershot->setDelay($options['delay']);
|
||||
}
|
||||
|
||||
if (isset($options['wait_until_network_idle']) && $options['wait_until_network_idle']) {
|
||||
$browsershot->waitUntilNetworkIdle();
|
||||
}
|
||||
// waitUntilNetworkIdle() is always enabled (configured above on line 47)
|
||||
// Removed conditional logic as network idle waiting is required for production
|
||||
|
||||
// Apply ad/tracker blocking
|
||||
if (($options['block_ads'] ?? true) || ($options['block_trackers'] ?? true)) {
|
||||
|
||||
Reference in New Issue
Block a user