Skip to content

Commit

Permalink
Collabora Online 21.11
Browse files Browse the repository at this point in the history
  • Loading branch information
timar committed Nov 25, 2021
1 parent bf4aebf commit 1721d6b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@

## 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)
- Collabora Office tag [cp-6.4-20](https://git.libreoffice.org/core/+/refs/tags/cp-6.4-20)

## 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)
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions build-nextcloud-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 30 additions & 30 deletions proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -44,35 +44,35 @@ 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;

clearstatcache();
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;
Expand All @@ -94,34 +94,34 @@ 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.");

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;

Expand Down Expand Up @@ -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');

Expand All @@ -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) {
Expand All @@ -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"}';
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1721d6b

Please sign in to comment.