diff --git a/CHANGELOG.md b/CHANGELOG.md index 9afdee1..ae730be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,7 +106,7 @@ ## 6.4.403 - 2021-02-01 ### Fixed: -- do not start loolwsd if it is started already (better fix) +- do not start coolwsd if it is started already (better fix) - fix crash with libfontconfig in Nextcloud snap ### AppImage version: - Collabora Online Development Edition (CODE) tag [cp-6.4.4-3](https://github.com/CollaboraOnline/online/releases/tag/cp-6.4.4-3) @@ -114,7 +114,7 @@ ## 6.4.303 - 2021-01-17 ### Fixed: -- do not start loolwsd if it is started already +- do not start coolwsd if it is started already ### AppImage version: - Collabora Online Development Edition (CODE) tag [cp-6.4.3-3](https://github.com/CollaboraOnline/online/releases/tag/cp-6.4.3-3) - Collabora Office tag [cp-6.4-19](https://git.libreoffice.org/core/+/refs/tags/cp-6.4-19) @@ -249,7 +249,7 @@ - Re-try with --appimage-extract-and-run when normal run of AppImage fails. - Check for fontconfig in proxy.php?status - Show icons on mobile user interface -- Do not check for root user when started with --disable-lool-user-checking (snap) +- Do not check for root user when started with --disable-cool-user-checking (snap) - Disable seccomp for AppImage - Make native drawing of FormattedField work [tdf#133498](https://bugs.documentfoundation.org/show_bug.cgi?id=133498) - Don't enter the OLE editing mode right after inserting a chart. diff --git a/build-nextcloud-app.sh b/build-nextcloud-app.sh index 8d348a6..ef3b7d8 100755 --- a/build-nextcloud-app.sh +++ b/build-nextcloud-app.sh @@ -44,10 +44,10 @@ test -d "${app_name}/collabora" || mkdir -p "${app_name}/collabora" test -f "${app_name}/collabora/Collabora_Online.AppImage" || curl "$APPIMAGE_URL" -o "${app_name}/collabora/Collabora_Online.AppImage" chmod a+x "${app_name}/collabora/Collabora_Online.AppImage" -# Create proxy.php and get the version hash from loolwsd into it +# Create proxy.php and get the version hash from coolwsd into it HASH=`./${app_name}/collabora/Collabora_Online.AppImage --version-hash` echo "HASH: $HASH" -sed "s/%LOOLWSD_VERSION_HASH%/$HASH/g" ../proxy.php > ${app_name}/proxy.php +sed "s/%COOLWSD_VERSION_HASH%/$HASH/g" ../proxy.php > ${app_name}/proxy.php # check if we are building for arm64 if [[ "$APPIMAGE_URL" =~ "arm64" ]]; then diff --git a/proxy.php b/proxy.php index 3e4669a..d7f3c24 100644 --- a/proxy.php +++ b/proxy.php @@ -16,7 +16,7 @@ */ // test with: -// http://localhost/richproxy/proxy.php?req=/loleaflet/dist/loleaflet.html?file_path=file:///opt/libreoffice/online/test/data/hello-world.odt +// http://localhost/richproxy/proxy.php?req=/browser/dist/cool.html?file_path=file:///opt/libreoffice/online/test/data/hello-world.odt function debug_log($msg) { @@ -44,10 +44,10 @@ function errorExit($msg) $appImage = __DIR__ . '/collabora/Collabora_Online.AppImage'; $tmp_dir = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(); -$lockfile = "$tmp_dir/loolwsd.lock"; -$pidfile = "$tmp_dir/loolwsd.pid"; +$lockfile = "$tmp_dir/coolwsd.lock"; +$pidfile = "$tmp_dir/coolwsd.pid"; -function getLoolwsdPid() +function getCoolwsdPid() { global $pidfile; @@ -55,24 +55,24 @@ function getLoolwsdPid() if (file_exists($pidfile)) { $pid = rtrim(file_get_contents($pidfile)); - debug_log("Loolwsd server running with pid: " . $pid); + debug_log("Coolwsd server running with pid: " . $pid); return $pid; } - debug_log("Loolwsd server is not running."); + debug_log("Coolwsd server is not running."); return 0; } -function isLoolwsdRunning() +function isCoolwsdRunning() { - $pid = getLoolwsdPid(); + $pid = getCoolwsdPid(); if ($pid === 0) return 0; return posix_kill($pid,0); } -function startLoolwsd() +function startCoolwsd() { global $appImage; global $pidfile; @@ -94,7 +94,7 @@ function startLoolwsd() if (file_exists("$pidfile")) unlink("$pidfile"); - debug_log("Launch the loolwsd server: $launchCmd"); + debug_log("Launch the coolwsd server: $launchCmd"); exec($launchCmd, $output, $return); if ($return) debug_log("Failed to launch server at $appImage."); @@ -102,26 +102,26 @@ function startLoolwsd() fclose($lock); } - while (!isLoolwsdRunning()) + while (!isCoolwsdRunning()) sleep(1); if (file_exists("$lockfile")) unlink("$lockfile"); } -function stopLoolwsd() +function stopCoolwsd() { - $pid = getLoolwsdPid(); + $pid = getCoolwsdPid(); if (posix_kill($pid,0)) { - debug_log("Stopping the loolwsd server with pid: $pid"); + debug_log("Stopping the coolwsd server with pid: $pid"); posix_kill($pid, 15 /*SIGTERM*/); } } -// Check that the setup is suitable for running the loolwsd. +// Check that the setup is suitable for running the coolwsd. // Returns the error ID if we find a problem. -function checkLoolwsdSetup() +function checkCoolwsdSetup() { global $appImage; @@ -222,7 +222,7 @@ function getallheaders() if ($request === '' && !$statusOnly) errorExit("Missing, required req= parameter"); -if (startsWith($request, '/hosting/capabilities') && !isLoolwsdRunning()) { +if (startsWith($request, '/hosting/capabilities') && !isCoolwsdRunning()) { header('Content-type: application/json'); header('Cache-Control: no-store'); @@ -247,11 +247,11 @@ function getallheaders() header('Content-type: application/json'); header('Cache-Control: no-store'); if (!$local) { - $err = checkLoolwsdSetup(); + $err = checkCoolwsdSetup(); if (!empty($err)) print '{"status":"error","error":"' . $err . '"}'; - else if (!isLoolwsdRunning()) { - startLoolwsd(); + else if (!isCoolwsdRunning()) { + startCoolwsd(); print '{"status":"starting"}'; } } else if ($errno === 111) { @@ -262,18 +262,18 @@ function getallheaders() // Version check. $obj = json_decode($response); $actVer = substr($obj->{'productVersionHash'}, 0, 8); // expVer is at most 8 characters long - $expVer = '%LOOLWSD_VERSION_HASH%'; - if ($actVer !== $expVer && $expVer !== '%' . 'LOOLWSD_VERSION_HASH' . '%') { // deliberately split so that sed does not touch this during build-time + $expVer = '%COOLWSD_VERSION_HASH%'; + if ($actVer !== $expVer && $expVer !== '%' . 'COOLWSD_VERSION_HASH' . '%') { // deliberately split so that sed does not touch this during build-time // Old/unexpected server version; restart. error_log("Old server found, restarting. Expected hash $expVer but found $actVer."); - stopLoolwsd(); + stopCoolwsd(); // wait 10 seconds max - for ($i = 0; isLoolwsdRunning() && ($i < 10); $i++) + for ($i = 0; isCoolwsdRunning() && ($i < 10); $i++) sleep(1); // somebody else might have restarted it in the meantime - if (!isLoolwsdRunning()) - startLoolwsd(); + if (!isCoolwsdRunning()) + startCoolwsd(); print '{"status":"restarting"}'; } @@ -301,11 +301,11 @@ function getallheaders() // Start the appimage if necessary if (!$local) { - $err = checkLoolwsdSetup(); + $err = checkCoolwsdSetup(); if (!empty($err)) errorExit($err); - else if (!isLoolwsdRunning()) - startLoolwsd(); + else if (!isCoolwsdRunning()) + startCoolwsd(); $logonce = true; while (true) { @@ -398,7 +398,7 @@ function getallheaders() } elseif($chunk === '') { debug_log("empty chunk last data"); if ($parsingHeaders) - errorExit("No content in reply from loolwsd. Is SSL enabled in error ?"); + errorExit("No content in reply from coolwsd. Is SSL enabled in error ?"); break; } elseif ($parsingHeaders) { $rest .= $chunk;