From: vincent@cubedesigners.com Date: Thu, 28 Oct 2021 18:17:31 +0000 (+0000) Subject: wait #4714 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8449c03eee9acf7d46012db412456a27d8c7daea;p=cubeextranet.git wait #4714 @1 --- diff --git a/fluidbook/tools/social_screenshot/social_screenshot.js b/fluidbook/tools/social_screenshot/social_screenshot.js index 4cec97364..74bc116fe 100644 --- a/fluidbook/tools/social_screenshot/social_screenshot.js +++ b/fluidbook/tools/social_screenshot/social_screenshot.js @@ -19,6 +19,7 @@ const optionDefinitions = [ height: options.height / options.scale, deviceScaleFactor: options.scale, }); + await page.setDefaultNavigationTimeout(0); await page.goto(options.url); await new Promise(r => setTimeout(r, 1000 * options.delay)); await page.screenshot({path: options.dest, type: 'jpeg', quality: 95}); diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 02af9fd7b..a265b45e6 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -173,6 +173,7 @@ class wsServices extends cubeFlashGateway { $this->outputXML = false; $dao = new wsDAOBook($this->con); + $daoTheme = new wsDAOTheme($this->con); if (isset($this->args['id']) && $this->args['id'] <= 18972) { $book = $dao->selectById($this->args['id']); @@ -197,8 +198,10 @@ class wsServices extends cubeFlashGateway if (!isset($cover)) { $cover = WS_FILES . '/social_image/' . $id . '.jpg'; - $limit = TIME - (3600 * 24 * 30); + $theme = $daoTheme->selectById($book->theme); + $limit = max(TIME - (3600 * 24 * 30), $book->changedate, $theme->date); $minsize = 20 * 1024; + //die($limit . ':' . $book->changedate . '//' . filemtime($cover)); if (isset($_GET['force']) || !file_exists($cover) || filemtime($cover) < $limit || filesize($cover) < $minsize) { @@ -207,7 +210,7 @@ class wsServices extends cubeFlashGateway touch($lock); $url = 'https://workshop.fluidbook.com/viewerh/' . $id . '_' . $book->hash . '_' . TIME . '/?nointerface=1'; - if (isset($_GET['forcecompile'])) { + if ((file_exists($cover) && filemtime($cover) < $limit) || isset($_GET['forcecompile'])) { $url .= '&force=1'; } $url .= '#/page/0'; @@ -215,23 +218,7 @@ class wsServices extends cubeFlashGateway $w = 1200; $h = 628; -// $tmp = CubeIT_Files::tempnam() . '.svg'; -// $cl = new CubeIT_CommandLine('xvfb-run'); -// $cl->setArg('a'); -// $cl->setArg('server-args', '-screen 0, ' . $w . 'x' . $h . 'x24'); -// $cl->setArg(null, '/usr/bin/cutycapt'); -// $cl->setArg('min-width', $w); -// $cl->setArg('min-height', $h); -// $cl->setArg('zoom-factor', 0.5); -// $cl->setArg('url', $url); -// $cl->setArg('delay', 10000); -// $cl->setArg('out', $tmp); -// $cl->execute(); -// $cl->debug(); -// -// $geo = $w . 'x' . $h; -// `convert $tmp -crop $geo+0+0 +repage -resize $geo -flatten $cover`; -// unlink($tmp); + $cl = new CubeIT_CommandLine('node'); $cl->setArg(null, WS_TOOLS . '/social_screenshot/social_screenshot.js');