Update
This commit is contained in:
16
SETUP.md
Normal file
16
SETUP.md
Normal 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
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
use Spatie\Browsershot\Browsershot;
|
use Spatie\Browsershot\Browsershot;
|
||||||
|
|
||||||
class BrowsershotService
|
class BrowsershotService
|
||||||
@@ -44,6 +45,10 @@ private function configureBrowsershot(string $url, array $options = []): Browser
|
|||||||
{
|
{
|
||||||
$browsershot = Browsershot::url($url);
|
$browsershot = Browsershot::url($url);
|
||||||
|
|
||||||
|
if (App::environment('production')) {
|
||||||
|
$browsershot->noSandbox();
|
||||||
|
}
|
||||||
|
|
||||||
// Basic configuration
|
// Basic configuration
|
||||||
if (isset($options['timeout'])) {
|
if (isset($options['timeout'])) {
|
||||||
$browsershot->timeout($options['timeout']);
|
$browsershot->timeout($options['timeout']);
|
||||||
|
|||||||
Reference in New Issue
Block a user