From: Vincent Vanwaelscappel Date: Wed, 21 Dec 2022 15:57:54 +0000 (+0100) Subject: wip #5661 @6 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f8b6d5927aa566135bc735e93e0492b49ab577a5;p=fluidbook-toolbox.git wip #5661 @6 --- diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index 341ef9949..4d26711a5 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -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" diff --git a/.docker/images/php/Dockerfile b/.docker/images/php/Dockerfile index af5556c27..20aa07eee 100644 --- a/.docker/images/php/Dockerfile +++ b/.docker/images/php/Dockerfile @@ -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 diff --git a/.docker/update b/.docker/update index 4e68f34f5..65faf2472 100644 --- a/.docker/update +++ b/.docker/update @@ -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 diff --git a/app/Fluidbook/Farm.php b/app/Fluidbook/Farm.php index b14290dd1..7a84a9a95 100644 --- a/app/Fluidbook/Farm.php +++ b/app/Fluidbook/Farm.php @@ -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) diff --git a/app/Fluidbook/Packager/MacOS.php b/app/Fluidbook/Packager/MacOS.php index f73634f14..331721db4 100644 --- a/app/Fluidbook/Packager/MacOS.php +++ b/app/Fluidbook/Packager/MacOS.php @@ -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() diff --git a/app/Fluidbook/Packager/WindowsZIP.php b/app/Fluidbook/Packager/WindowsZIP.php index 9d236fc14..63f03404c 100644 --- a/app/Fluidbook/Packager/WindowsZIP.php +++ b/app/Fluidbook/Packager/WindowsZIP.php @@ -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) diff --git a/app/Models/FluidbookDocument.php b/app/Models/FluidbookDocument.php index 30a4566b6..cd32b937f 100644 --- a/app/Models/FluidbookDocument.php +++ b/app/Models/FluidbookDocument.php @@ -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', diff --git a/scripts/update b/scripts/update index 1dfef82ce..bc1164e91 100644 --- a/scripts/update +++ b/scripts/update @@ -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