Commit Graph

35 Commits (1b3218df0466a59fd1e9a8df72d97ede6448425e)

Author SHA1 Message Date
Skyler Grey 1b3218df04 Add cli option to use settings from env variables
Currently [in docker it is possible to do configuration through
environment variables](https://col.la/dockercodeconfigviaenv), which
works using the start-collabora-online.sh start-collabora-online.pl
scripts. This commit lets COOLWSD listen to the same environment
variables directly

Change-Id: I75762ad620132037523fa82167a3ff17075c7027
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
2023-09-23 12:44:50 +02:00
Rash419 b717be603e implement document migration
- updated protocol.txt

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I67a0515580979e15223ea084c835f5ed801ceb5e
2023-06-29 18:21:33 +02:00
Marco Cecchetti 39be94e852 Force notebookbar ui when a11y is enabled
When accessibility is enabled in coolwsd.xml, overrides setting in
<user-interface> section by force to use the notebookbar UI.

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I98f4b288439b21110214ca2a67df639b397184c9
2023-06-15 08:54:51 +01:00
Ashod Nakashian c9542a44cd wsd: thread-safe kit pid
Change-Id: Id8dc3b894d18606e80806950f8bad65cf657a565
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-14 07:04:26 -04:00
Ashod Nakashian df89ec90ae wsd: http: killpoco in prisoner http handler
Change-Id: I82f030d1d91afa504a095b852dcdaec9d2df386d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 15:25:58 -04:00
Ashod Nakashian 6ed935bf89 wsd: quarantine: encapsulate QuarantineMap
Change-Id: I8b4da2cb4c2291c70f6a0d513a72f47899428e3e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian 7ea3495f22 wsd: quarantine: convert Quarantine to a class
Change-Id: I9478f35e6c7c3f156aa15072e31c38bc84dc2b64
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian 4456acd2da wsd: make unreusable classes final
Change-Id: Ieea44cdba1315051ede7dde6e154055a0820b0a8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Michael Meeks f6bd976f00 Jail cleanup - include coolwsd pid + hash into a jails sub-directory.
This avoids removing the jails of other running coolwsd that share
the same jails/ directory, such as unit-tests, cypress tests etc.

Assert on fatal system error to help catch this during test builds.

Remove old unit-test specific approach, and generalize it, since
apparently we did a recursive cleanup of other people's jails anyway.

Remove over-complicated recursive approach, for a rather simpler
one-level scheme. Avoid following symlinks too for safety.

Remove obsolete lo_jail_subpath setting.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I371f8c0e22f64fb2befb4b58f72cefa39567f3b5
2023-04-25 10:41:57 +01:00
Michael Meeks 93b41527e3 Cypress: accelerate tests by not re-downloading & JITting JS.
add forcecaching parameter to coolwsd for debug mode.

Change-Id: I6f38e9a4fd6dbb76e92105c76e8abe3e75f19ef5
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-04-15 11:45:22 -04:00
Michael Meeks 7ba6c10e6d valgrind / massif - improve things a little.
Avoid SIGKILL'ing children when valgrinding to allow time to save
massif traces etc.

Change-Id: I255a62b6605164ac5037a06455f1adfcba05759c
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-03-23 11:31:24 +00:00
Ashod Nakashian b5de21a0ad wsd: simplify passing mobileAppDocId to getNewChild
It seems more complex to have #ifdef guarded logic
around a function call to pass or not pass an argument
when we that same argument is already defaulted in
that function.

If the difference between the two paths is primarily
the argument, then we can always pass it, making sure
that in the case that defaulting would have been used
that we pass the same default value. This is now done
with assertions.

Change-Id: I333eb3f42cb51dfab8584ae8c5aa52ee45c5a9a1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-14 20:40:40 +01:00
Rash419 f63d07bdea wsd: store routeToken in server
- added routeToken in ClientSession::createPublicURI

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ib4a211e69d96589dd735ba8e32ddbe5f98c96509
2023-01-31 15:32:30 +01:00
Rash419 2529fa9ee2 notify client when route tokens get updated
- once client get notification it will update the routetoken
by refetching it from indirection url endpoint
- added support to configure indirectionurl enpoint using
remote config

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Iead22af56c655bdece6b70cc4e97a1fa401b1bae
2023-01-31 15:32:30 +01:00
Ashod Nakashian 2e01170920 wsd: request Kit termination early when unloading
DocBroker now requests the Kit process to terminate
earlier than before to give it time to disconnect
while we (DocBroker) are still around. In turn,
upon disconnection, PrisonerRequestDispatcher can
query whether we are unloading or not, to detect
unexpected disconnections.

Change-Id: Ifa102e018e32bb252a0c169b0a3df691bca4ab0c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-12-21 19:41:38 -05:00
Ashod Nakashian 55ed57dce2 wsd: support flushing control in WSProcess::sendFrame
Change-Id: Iba1b3869a5c0aa816f78bdf59347b6e9408e8f97
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-12-21 19:41:38 -05:00
Michael Meeks dadfbf0579 allow more verbose log-level during startup to be configured.
Previously this defaulted to 'trace' - now it can be configured, but
still defaults to 'trace'.

Change-Id: I0ecf2f0b991cd8cc29dbde866dd4589be4ca7957
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-11-21 21:44:05 +01:00
Ashod Nakashian ac52505640 wsd: getServerURL is debug/test only
Change-Id: Ic4c2fe3b467fee475cdc7c0b91b1df77f441c0aa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-11-20 07:50:12 -05:00
Henry Castro abfbf4846d wsd: add remote buy product url
Change-Id: I97617ddf8c7a0fc923788477fb077f3baa16fe13
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-09-29 10:28:18 +03:00
Michael Meeks 2b20e4050d Forward setclipboard data to the Kit as a binary message:
assert: invalid utf-8 - check Message::detectType()
 #3  0x00007fce7ae57fd6 in __GI___assert_fail at ./net/WebSocketHandler.hpp",
 #4  0x0000558bd2790231 in WebSocketHandler::sendFrame at ./net/WebSocketHandler.hpp:748
 #5  0x0000558bd2851202 in WebSocketHandler::sendMessage (flush=false, code=WSOpCode::Text, len=22118,
     data=0x7fce5c227b50 "child-045 setclipboard\napplication/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"\n1370\nPK\003\004\024", this=0x7fce6c003340)
     at ./net/WebSocketHandler.hpp:641
 #6  WebSocketHandler::sendTextMessage (flush=false, len=22118, ...) at ./net/WebSocketHandler.hpp:619
 #7  WebSocketHandler::sendMessage (msg="child-045 setclipboard\nappl...) at ./net/WebSocketHandler.hpp:613
 #8  WSProcess::sendTextFrame (this=0x7fce6c001300, data="child-045 setclipboard\nap...) at wsd/COOLWSD.hpp:142
 #9  0x0000558bd27d5678 in DocumentBroker::forwardToChild (this=this@entry=0x7fce64027940, viewId="045", message="setclipboard\n...) at /usr/include/c++/9/bits/shared_ptr_base.h:1020
 #10 0x0000558bd2899d50 in ClientSession::handleClipboardRequest (this=0x7fce64027dc0, type=type@entry=DocumentBroker::CLIP_REQUEST_SET, ...) at ./common/Session.hpp:76
 #11 0x0000558bd27e0999 in DocumentBroker::handleClipboardRequest (this=0x7fce64027940, type=DocumentBroker::CLIP_REQUEST_SET, ...) at /usr/include/c++/9/bits/shared_ptr_base.h:1020
 #12 0x0000558bd2847b8b in ClientRequestDispatcher::handleClipboardRequest(...) at /usr/include/c++/9/bits/shared_ptr_base.h:1020

Change-Id: I406eee0ac3a47986fdd9511e674c9228d1994d38
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-08-27 08:21:28 -04:00
Miklos Vajna 3205899a31 libfuzzer: fix clientsession_fuzzer
The fuzzer case doesn't read the configuration. This is similar to
what getConfigValue() already did, now extended to
getConfigValueNonZero().

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I14a838ea9875d81413f22140eeac627520c423ab
2022-08-23 10:50:50 +02:00
Ashod Nakashian 5e0c29c73b wsd: move the autosave interval into SaveManager
Change-Id: I79e33e3089a4da0c1d968b0fdbc2f4bab55c4fc6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-06 20:38:09 -04:00
Ashod Nakashian c2ba9c8a77 wsd: extend the fork timeout when copying systemplate
While bind-mounting is very fast, linking and copying
are both often much slower. Normally, we give extra
time to forking Kit the first time, but then we
reduce the timeout there after. Here, we take into
account whether or not bind-mounting is enabled
before we reduce the timeout to the normal level.
That is, if bind-mounting isn't enabled, we leave
the timeout to be higher-than-normal to accomodate
slow linking or copying.

The benefit of this is evident in the stability of
tests when bind-mounting is disabled (even on fast
filesystems with linking).

Change-Id: I959abf6d3253b2c91be8e0c9a59ec12511817bb9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 14:45:12 -04:00
Ashod Nakashian 5c6516e4e4 wsd: support code-coverage report via --with-coverage
This adds support for code-coverage HTML reporting.
To achieve this, we must use file-linking in jails
so that we can update the coverage data (.gcda files)
from the jails. This means that creating jails is
slower than with bind-mounting and we need to
account for that in our timeouts.

We also can't kill child processes with SIGKILL,
which is un-catchable. Instead, we use SIGTERM
and dump the profile data before exiting.

Change-Id: I16fa534f6ed42f7133014d841bb024423315e0a4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 14:45:12 -04:00
Ashod Nakashian b77dfc47d2 wsd: remove default arg from SigUtil::killChild
Explicit is always better. We also need to
terminate more gracefully when profiling.

Change-Id: I7145cb59583c5d7c6362bbf9c74e9d21799eaa33
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 07:51:52 -04:00
Ashod Nakashian b3d298bd84 wsd: minor cleanup of addNewChild
This moves the shared_ptr copy to outside the
lock, as well as reducing logging inside it.

Change-Id: Iedde95b3fe60fc40bbd035a9d43a9b95af7efdcc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-12 13:43:43 +01:00
Henry Castro ccd15ce9a6 wsd: add getter function to obtain the ...
Web server poller thread

Change-Id: I1b1785e41891e408eb6ebc360baf15c4fd07bf5f
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-06-07 15:42:53 +01:00
Henry Castro 7ed475f25c wsd: infobar: fetch and save the latest version data
Change-Id: I7988fc69d4eaa35a26463cf180c26c6fd9b083e1
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-05-12 18:25:10 +01:00
Henry Castro 6bfe68ea93 wsd: add parameter --signal
To signal SIGUSR2 to parent to notify
that the server is ready to accept connections,
and begin the tests.

Change-Id: Ie936217243aa7a2e836f3d45cb508ede13fae8c5
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-04-27 09:18:21 +01:00
Ashod Nakashian 96adaa15d1 wsd: kill coolwsd_fuzzer
coolwsd_fuzzer predates actual fuzzing
with libfuzzer and is currently unsused.

Change-Id: Id095b165943ba14dbf525ddc607ad329f5d952d4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-20 07:12:03 -04:00
Tor Lillqvist f98900c73c Add a remote font download feature
The coolwsd.xml file can now contain a URI of a JSON file on some
server that contains URIs of fonts. These fonts are downloaded to the
coolwsd server. Just like the remote configuration thing, the URIs are
checked once a minute and the JSON or the fonts mentioned in it are
re-downloaded if their contents has changed.

If a font has been removed from the JSON file then the corresponding
downloaded could be removed, too. But there is no way to remove it
from core without restarting the whole COOL server, so we don't
bother.

We need to put the font in such a place so that its pathname is the
same both in the ForKit process (outside any chroot jail) and in a Kit
process (inside its own jail(), because even if it is in the ForKit
process that we call the LO core vcl API to load a "temporary" font,
code elsewhere in LO core re-opens the font file later, naturally
using the same pathname, when it is needed (see
FreetypeFontFile::Map() in vcl/unx/generic/glyphs/freetype_glyphcache.cxx).

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: If78058ddff5ed05c7a82d7ea465a7a414fd0d861
2022-04-15 17:32:41 +03:00
Henry Castro c550a206e8 Remove the old vex-based welcome dialog code
... and make Welcome dialog optional for COOL

config: add welome url parameter

Signed-off-by: Henry Castro <hcastro@collabora.com>

config: add feedback url parameter

Signed-off-by: Henry Castro <hcastro@collabora.com>

config: add infobar-url parameter

Signed-off-by: Henry Castro <hcastro@collabora.com>

welcome: fix unhandled exceptions

Signed-off-by: Henry Castro <hcastro@collabora.com>

welcome: preprocess welcome file

added welcome-message.html

Signed-off-by: Henry Castro <hcastro@collabora.com>

welcome: clean up code related to vex welcome

Signed-off-by: Henry Castro <hcastro@collabora.com>

--enable-welcome-message is not necessary, when we specify a welcome URL, then it is enabled, otherwise it's user configurable

Signed-off-by: Andras Timar <andras.timar@collabora.com>

remove the unused welcome config settings

Signed-off-by: Andras Timar <andras.timar@collabora.com>

remove unused define ENABLE_FEEDBACK

Signed-off-by: Andras Timar <andras.timar@collabora.com>

do not install/package fallback welcome dialog, when welcome feature is not configured

Signed-off-by: Andras Timar <andras.timar@collabora.com>

remove welcome-message.html

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I20aa6220362018b63aaebd114b2b661561823fbb
2022-04-04 10:53:07 +02:00
Tor Lillqvist 037a0929f0 Remove two forward declarations from COOLWSD.hpp
Only one of them is needed, and only in COOLWSD.cpp itself.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I03864afdc13e778a2b8ce8205e135d679dddf13d
2022-03-22 11:38:51 +02:00
Ashod Nakashian f8b05a0f83 wsd: support unattended runs
With --unattended, do not wait for a debugger
upon seg-faulting. This avoids the unnecessary wait
that prolongs failed unit-tests in automated runs.
Now run_unit.sh and Cypress Makefile set this flag.

Note that the wait only happens when in debug
builds, or when envar COOL_DEBUG is set. This
prevents us from waiting when running a debug
build where we can't see the output, or indeed
the run is on a CI build machine.

This flag can also be used by devs when reproducing
failures where there is no interest in attaching
a debugger. The logs are shorter and more
readable, too. At least in trace level.

Change-Id: Ice15482c6724abc47f5955402295198eb7f671ee
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-17 18:52:48 -05:00
Andras Timar f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00