From: Vincent Vanwaelscappel Date: Wed, 28 Jun 2023 08:01:19 +0000 (+0200) Subject: wip #5898 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b6fa8d8f96d79ec4224204698a35222a9e11b71a;p=fluidbook-toolbox.git wip #5898 --- diff --git a/app/Fluidbook/Compiler/Secure.php b/app/Fluidbook/Compiler/Secure.php index 4f88caa1a..e21c25f3e 100644 --- a/app/Fluidbook/Compiler/Secure.php +++ b/app/Fluidbook/Compiler/Secure.php @@ -79,7 +79,8 @@ trait Secure $l10n = $this->getFluidbook()->getTranslations(); - $locale = $this->fluidbookSettings->secureClientSideLocale === 'fluidbook' ? $l10n['default'] : $l10n[$this->fluidbookSettings->secureClientSideLocale]; + $secureLocale = $this->fluidbookSettings->secureClientSideLocale ?: 'default'; + $locale = $this->fluidbookSettings->secureClientSideLocale === 'fluidbook' ? $l10n['default'] : $l10n[$secureLocale]; $variables['FORM_USERNAME'] = $locale['Username'] ?? 'Username'; $variables['FORM_PASSWORD'] = $locale['Password'] ?? 'Password'; $variables['FORM_SIGN_IN'] = $locale['Sign in'] ?? 'Sign in'; @@ -111,7 +112,7 @@ trait Secure }); });'; $variables['CSS'] = $this->fluidbookSettings->secureClientSideStyles; - + $this->fluidbookSettings->secureClientSideFont = $this->fluidbookSettings->secureClientSideFont ?: 'OpenSans'; $this->addFontKit($this->fluidbookSettings->secureClientSideFont); $variables['FONT'] = $this->fluidbookSettings->secureClientSideFont; $variables['LINKS'] .= ''; diff --git a/app/Fluidbook/SocialImage.php b/app/Fluidbook/SocialImage.php index 7a11b3b75..d9a8f7961 100644 --- a/app/Fluidbook/SocialImage.php +++ b/app/Fluidbook/SocialImage.php @@ -46,13 +46,17 @@ class SocialImage $cl->setArg(null, resource_path('fluidbookpublication/social_screenshot/social_screenshot.js')); $cl->setArg('width', $w); $cl->setArg('height', $h); - $cl->setArg('delay', 2); + $cl->setArg('delay', 10); $cl->setArg('scale', 0.5); $cl->setArg('dest', $res); $cl->setArg('url', '"' . $url . '"'); $cl->execute(); unlink($lock); + if (!file_exists($res)) { + $cl->dd(); + } + self::getSocialImageSize($fluidbook); } } diff --git a/app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php b/app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php index c604d5d08..0d81c9a19 100644 --- a/app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php +++ b/app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php @@ -46,7 +46,7 @@ trait PreviewOperation protected function _preview($segment, $version, $id, $hash, $time = null, $path = null) { - PHP::neverStop(false); + PHP::neverStop(true); $q = request()->getQueryString(); if ($q) { $q = '?' . $q; diff --git a/resources/fluidbookpublication/social_screenshot/social_screenshot.js b/resources/fluidbookpublication/social_screenshot/social_screenshot.js index 20954d803..5385dd2a2 100644 --- a/resources/fluidbookpublication/social_screenshot/social_screenshot.js +++ b/resources/fluidbookpublication/social_screenshot/social_screenshot.js @@ -18,6 +18,7 @@ const optionDefinitions = [ "--no-sandbox", ], executablePath: 'google-chrome-stable', + protocolTimeout: 1800000, }); const page = await browser.newPage(); page.on('console', msg => console.log('PAGE LOG:', msg)); @@ -27,8 +28,10 @@ const optionDefinitions = [ deviceScaleFactor: options.scale, }); await page.setDefaultNavigationTimeout(0); - await page.goto(options.url, {waitUntil: 'networkidle2'}); - await new Promise(r => setTimeout(r, 1000 * options.delay)); - await page.screenshot({path: options.dest, type: 'jpeg', quality: 95}); + const response = await page.goto(options.url, {waitUntil: 'networkidle2', timeout: 0}); + if (response.status() === 200) { + await new Promise(r => setTimeout(r, 1000 * options.delay)); + await page.screenshot({path: options.dest, type: 'jpeg', quality: 95}); + } await browser.close(); })();