]> _ Git - cubeextranet.git/commitdiff
wait #4714 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 28 Oct 2021 18:17:31 +0000 (18:17 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 28 Oct 2021 18:17:31 +0000 (18:17 +0000)
fluidbook/tools/social_screenshot/social_screenshot.js
inc/ws/Controlleur/class.ws.services.php

index 4cec973641fce68114b84f8a052bd4e4bee648b6..74bc116fe693e00338debb43292352a101ea0a25 100644 (file)
@@ -19,6 +19,7 @@ const optionDefinitions = [
         height: options.height / options.scale,\r
         deviceScaleFactor: options.scale,\r
     });\r
+    await page.setDefaultNavigationTimeout(0);\r
     await page.goto(options.url);\r
     await new Promise(r => setTimeout(r, 1000 * options.delay));\r
     await page.screenshot({path: options.dest, type: 'jpeg', quality: 95});\r
index 02af9fd7b13e5c1f7b55d8d381e20249a78958bb..a265b45e69986860ee2fa8b9a9f63ce37c5110e8 100644 (file)
@@ -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');