]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5661 @6
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 21 Dec 2022 15:57:54 +0000 (16:57 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 21 Dec 2022 15:57:54 +0000 (16:57 +0100)
.docker/docker-compose.yml
.docker/images/php/Dockerfile
.docker/update
app/Fluidbook/Farm.php
app/Fluidbook/Packager/MacOS.php
app/Fluidbook/Packager/WindowsZIP.php
app/Models/FluidbookDocument.php
scripts/update

index 341ef9949851687130e242432ec99a2d0f6ab2e2..4d26711a552c6e4b4cec0008befed0161b13a0da 100644 (file)
@@ -9,14 +9,13 @@ services:
       - '/home/toolbox/www/.docker/config/httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf'
       # Files
       - '/home/extranet/share:/application/share'
-      - '/mnt:/mnt'
       - '/home/toolbox/www:/application'
       - '/home/toolbox/www/storage/app/public/:/application/public/storage/'
       - '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/protected/fluidbookpublication/docs/'
-      - '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/fluidbook/docs/'
       - '/data/extranet/www/fluidbook/books/working/:/application/protected/fluidbookpublication/working/'
       - '/home/extranet:/home/extranet'
       - '/data/extranet:/data/extranet'
+      - '/mnt:/mnt'
     ports:
       - '37126:80'
     environment:
@@ -72,10 +71,10 @@ services:
       - '/home/toolbox/www:/application'
       - '/home/toolbox/www/storage/app/public/:/application/public/storage/'
       - '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/protected/fluidbookpublication/docs/'
-      - '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/fluidbook/docs/'
       - '/data/extranet/www/fluidbook/books/working/:/application/protected/fluidbookpublication/working/'
       - '/home/extranet:/home/extranet'
       - '/data/extranet:/data/extranet'
+      - '/mnt:/mnt'
     ports:
       - '58744:8123'
       - '58745:22'
@@ -127,3 +126,15 @@ networks:
   fluidbook-processfarm:
     external:
       name: fluidbook-processfarm
+
+#volumes:
+#  # sshcmd=vince@paris.cubedesigners.com\:/C:/Sign -o port=22422 -o uid=1001 -o gid=33 -o allow_other -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 codesign
+#  codesign:
+#    driver: vieux/sshfs:latest
+#    driver_opts:
+#      sshcmd: "vince@paris.cubedesigners.com:/C:/Sign"
+#      allow_other: ""
+#      uid: "1001"
+#      gid: "33"
+#      reconnect: ""
+#      identityfile: "/root/.ssh/id_rsa"
index af5556c2783933828b7d5abe181bac5c1818a954..20aa07eee8e1fc1366ff0c8870ac21528438accd 100644 (file)
@@ -69,7 +69,8 @@ RUN apt-get -y --no-install-recommends install build-essential chrpath libssl-de
 RUN apt-get -y --no-install-recommends install libreoffice
 RUN apt-get -y --no-install-recommends install lftp
 RUN apt-get -y --no-install-recommends install sshfs python3 python3-pip
-RUN apt-get -y --no-install-recommends install openssh-server rsyslog wine64
+RUN apt-get -y --no-install-recommends install openssh-server rsyslog wine libwine wine64
+RUN apt-get -y --no-install-recommends install wine wine64
 
 RUN apt-get -y --no-install-recommends install locales
 RUN sed -i '/fr_FR.UTF-8/s/^# //g' /etc/locale.gen && \
@@ -86,7 +87,7 @@ RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o
 RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
 
 ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
-RUN npm install --unsafe-perm --global uglify-js less sass puppeteer favicons nw-builder@^4
+RUN npm install --unsafe-perm --global uglify-js less sass puppeteer favicons nw-builder@^3
 RUN pip3 install font-line
 
 RUN groupadd sudo;useradd -d /application -g 33 -G sudo -s /bin/bash -u 1001 toolbox
index 4e68f34f5a68db38f02489d053c8b2af0f57cd4e..65faf2472840d57db6e6e9c5909136019e8a45b7 100644 (file)
@@ -1,5 +1,8 @@
 #!/bin/sh
 cd /docker/fluidbook-toolbox
+#docker plugin install --grant-all-permissions vieux/sshfs sshkey.source=/home/toolbox/www/.docker/config/ssh/root
+#docker volume create -d vieux/sshfs -o sshcmd=vince@paris.cubedesigners.com\:/C:/Sign -o port=22422 -o uid=1001 -o gid=33 -o allow_other -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 codesign
+#docker volume create -d vieux/sshfs -o sshcmd=vincent@paris.cubedesigners.com\:/ -o port=22022 -o uid=1001 -o gid=33 -o allow_other -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 macparis
 chown root:root /home/toolbox/www/.docker/config/cron/host;ln -sf /home/toolbox/www/.docker/config/cron/host /etc/cron.d/toolbox
 docker network create fluidbook-toolbox
 docker compose down
index b14290dd1ea3733246d3896ac9a22c233e1ffb73..7a84a9a9507da28d70d79757600c99436746eb0e 100644 (file)
@@ -100,7 +100,7 @@ class Farm
 
         error_log($log);
 
-        return $res;
+        return str_replace('/fluidbook/docs/','/protected/fluidbookpublication/docs/',$res);
     }
 
     public static function ping($echo = true, $force = false)
index f73634f1485124fe18ac231ec469f6b6fc7d9979..331721db4524948e7a25aad67ff6dc1221a093a7 100644 (file)
@@ -4,13 +4,15 @@ namespace App\Fluidbook\Packager;
 
 use Cubist\Util\CommandLine;
 
-class MacOS extends OfflineHTML
+class MacOS extends WindowsZIP
 {
-    protected $nwplatform = 'osx64';
-    protected $nwversion = '0.49.2';
+    protected $nwplatform = 'osx';
+    protected $arch='x64';
+    protected $nwversion = '0.71.0';
     protected $node_platform = 'mac';
     protected $exenameMaxlength = 28;
     public $type = 'mac_exe_html';
+    protected $packageIconExt='icns';
 
 
     public function makePackage($zip)
@@ -41,38 +43,15 @@ class MacOS extends OfflineHTML
         return $res;
     }
 
-    protected function preparePackage()
-    {
-        $this->initTempDir();
-        $this->copyFluidbookFiles();
-        $this->makeJSON();
-
-        $this->buildPath = WS_PACKAGER . '/nwbuild/' . $this->version . '/' . $this->book_id;
-        if (!file_exists($this->buildPath)) {
-            mkdir($this->buildPath, 0777, true);
-        }
-
-        $cl = new CommandLine('nwbuild');
-        $cl->setArg('p', $this->nwplatform);
-        $cl->setArg('o', $this->buildPath);
-        $cl->setArg('v', $this->nwversion);
-        $cl->setArg('winIco', $this->vdir . '/icon.ico');
-        $cl->setArg('macIcns', $this->vdir . '/icon.icns');
-        $cl->setArg(null, $this->vdir);
-        $cl->execute();
-        $cl->debug();
-
-        $this->replaceFFMpeg();
-        if (!file_exists($this->getAppPath())) {
-            die('Error while building mac app : ' . $cl->commande . ' // ' . $cl->output);
-        }
 
+    public function signExe()
+    {
         $this->signApp();
     }
 
     function replaceFFMpeg()
     {
-        copy(WS_COMPILE_ASSETS . '/_exehtml/_ffmpeg/libffmpeg.dylib', $this->getAppPath() . '/Contents/Frameworks/nwjs Framework.framework/Versions/Current/libffmpeg.dylib');
+        copy($this->resource_path('_ffmpeg/libffmpeg.dylib'), $this->getAppPath() . '/Contents/Frameworks/nwjs Framework.framework/Versions/Current/libffmpeg.dylib');
     }
 
     protected function signApp()
index 9d236fc14ab92095aabc4491adf5e66a4ad7fc48..63f03404cc1f391201f77d1a2eba6f76dbff899f 100644 (file)
@@ -19,6 +19,8 @@ class WindowsZIP extends Base
     protected $node_platform = 'win';
     protected $exenameMaxlength = 30;
     protected $_compileOnConstruct = true;
+    protected $packageIconExt = 'ico';
+    protected $nwbuildVersion = '3.8.6';
 
     protected $_ext = 'html';
 
@@ -56,16 +58,44 @@ class WindowsZIP extends Base
 
         `umask 0000;sudo rm -rf $this->buildPath;mkdir -p 0777 $this->buildPath;chmod -R 777 $this->vdir;mkdir -p 0777 /application/tmp;chmod -R 777 /application/tmp`;
 
-        $cl = new CommandLine('nwbuild');
-        $cl->setArg('platform', $this->nwplatform);
-        $cl->setArg('outDir', $this->buildPath);
-        $cl->setArg('flavour', "normal");
-        $cl->setArg('version', $this->nwversion);
-        $cl->setArg('arch', $this->arch);
-        $cl->setArg('winIco', $this->vdir . 'icon.ico');
-        $cl->setArg('macIcns', $this->vdir . 'icon.icns');
-        $cl->setArg(null, $this->vdir);
-        $cl->execute();
+//        For
+//        $cl = new CommandLine('nwbuild');
+//        $cl->setArg('platform', $this->nwplatform);
+//        $cl->setArg('outDir', $this->buildPath);
+//        $cl->setArg('flavour', "normal");
+//        $cl->setArg('version', $this->nwversion);
+//        $cl->setArg('arch', $this->arch);
+//        $cl->setArg(null, $this->vdir);
+//        $cl->execute();
+
+        if ($this->nwbuildVersion === 3) {
+            $platform = $this->getNWbuilder3Platform();
+
+            $cl = new CommandLine('nwbuild');
+            $cl->setArg(null, $this->vdir . '**');
+            $cl->setLongArgumentSeparator(' ');
+            $cl->setArg('platforms', $platform);
+            $cl->setArg('buildDir', $this->buildPath);
+            $cl->setArg('version', $this->nwversion);
+            $cl->setArg('mode', 'build');
+            $cl->setArg('flavor', 'normal');
+            if ($this->nwplatform === 'win') {
+                $cl->setArg('winIco', $this->vdir . 'icon.ico');
+                $cl->setArg('useRcedit', 'true');
+            } elseif ($this->nwplatform === 'osx') {
+                $cl->setArg('macIcns', $this->vdir . 'icon.icns');
+            }
+            $cl->execute();
+        } else {
+            $cl = new CommandLine('nwbuild');
+            $cl->setArg('platform', $this->nwplatform);
+            $cl->setArg('outDir', $this->buildPath);
+            $cl->setArg('flavour', "normal");
+            $cl->setArg('version', $this->nwversion);
+            $cl->setArg('arch', $this->arch);
+            $cl->setArg(null, $this->vdir);
+            $cl->execute();
+        }
 
         `sudo chown -R 1001:33 $this->buildPath`;
 
@@ -78,10 +108,25 @@ class WindowsZIP extends Base
         $this->signExe();
     }
 
+    protected function getNWBuilder3Platform()
+    {
+        if ($this->nwplatform === 'osx') {
+            return 'osx64';
+        } else if ($this->nwplatform === 'win') {
+            if ($this->arch === 'x64') {
+                return 'win64';
+            } else {
+                return 'win32';
+            }
+        }
+    }
+
     function signExe()
     {
-        $exe = $this->buildPath . $this->exeName . '.exe';
-        $this->_sign($exe);
+        $exe = $this->getFinalPackageDir() . '/' . $this->exeName . '.exe';
+        if (file_exists('/mnt/sshfs/codesign')) {
+            $this->_sign($exe);
+        }
     }
 
     function _sign($source, $symbolicLink = false)
@@ -119,7 +164,11 @@ class WindowsZIP extends Base
      */
     function makeJSON()
     {
-        $data = ['app_name' => $this->appName, 'main' => 'index.html', 'name' => $this->exeName, 'version' => '1.0.' . $this->_time,
+        $data = ['app_name' => $this->appName,
+            'main' => 'index.html',
+            'name' => $this->exeName,
+            'version' => '1.0.' . $this->_time,
+            'icon' => 'icon.' . $this->packageIconExt,
             'webkit' => [],
             'window' => [
                 'height' => 768,
@@ -127,7 +176,6 @@ class WindowsZIP extends Base
                 'title' => $this->appName,
                 'id' => 'main',
                 'icon' => 'icon.png',
-                'mac_icon' => 'icon.icns'
             ],
             'dependencies' =>
                 [
@@ -160,7 +208,11 @@ class WindowsZIP extends Base
 
     public function getFinalPackageDir()
     {
-        return $this->buildPath;
+        if ($this->nwbuildVersion === 3) {
+            return $this->buildPath . '/' . $this->exeName . '/' . $this->getNWBuilder3Platform();
+        } else {
+            return $this->buildPath;
+        }
     }
 
     protected function compile($forceCompile = false)
index 30a4566b630d97d84f762ba1b6ffa686cef9dd9e..cd32b937fe17f8324f630844b93a89b58810fe4c 100644 (file)
@@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Cache;
 
 class FluidbookDocument extends ToolboxModel
 {
-    public const WS_DOCS = '/application/fluidbook/docs/';
+    public const WS_DOCS = '/application/protected/fluidbookpublication/docs/';
     protected $table = 'fluidbook_document';
     protected $_options = ['name' => 'fluidbook-document',
         'singular' => 'document',
index 1dfef82ce5872f4d737ac1781c4038232f570633..bc1164e9124531481051d316290049c0ee0bdc44 100644 (file)
@@ -16,6 +16,7 @@ composer dump-autoload
 sudo /application/scripts/restartworkers
 /application/scripts/updatenpm
 sudo chown -R 1001:33 /application/storage/framework
+sudo chown -R 1001:33 /application/storage/framework
 php artisan optimize:clear
 php artisan cubist:magic:precache
 sudo chown -R 1001:33 /application/storage/framework