This commit is contained in:
ct
2025-08-10 23:05:55 +08:00
parent 1d05a7b4e3
commit 4f55c09e1c
2 changed files with 34 additions and 13 deletions

16
SETUP.md Normal file
View File

@@ -0,0 +1,16 @@
# Check if node and npm are installed
node -v && npm -v
# Install puppeteer
sudo npm install -g puppeteer
# Install chromium
npx puppeteer browsers install chrome
# Install dependencies
sudo apt update
sudo apt install libx11-xcb1 libxcomposite1 libasound2t64 libatk1.0-0 libatk-bridge2.0-0 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates install libnss3

View File

@@ -2,6 +2,7 @@
namespace App\Services;
use Illuminate\Support\Facades\App;
use Spatie\Browsershot\Browsershot;
class BrowsershotService
@@ -44,6 +45,10 @@ private function configureBrowsershot(string $url, array $options = []): Browser
{
$browsershot = Browsershot::url($url);
if (App::environment('production')) {
$browsershot->noSandbox();
}
// Basic configuration
if (isset($options['timeout'])) {
$browsershot->timeout($options['timeout']);