Commit graph

189 commits

Author SHA1 Message Date
Ashod Nakashian
1cac1f1698 wsd: test: do not advance to next test on failure
Change-Id: I2831c90e088064f5a254ef8a9809796e8320ed04
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
7fdc33b916 wsd: no default parameters for DocumentBroker::autoSave
Change-Id: Id343cc36886c2768b4af7ee61d9524678c83dc69
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
b1d68e4b3a wsd: better context logging for clipboard activity
Change-Id: I83935df41492e0267b924893594002e6665a671d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
8ef57dd2ec wsd: better newChild unit-test event
Change-Id: I8403e14780ad0bf971625934b7011fba1f24f07c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
7824df4926 wsd: notify the client of loading errors
Change-Id: Ied18f6820a7c3ceb4cc29200111c4a73442d2808
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-30 21:45:40 +02:00
Ashod Nakashian
5fdc4f9623 wsd: better logging of document and session loading
Change-Id: I0cdf08bf711499e63f09c3db6f3f47e873eb3b59
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-30 21:45:40 +02:00
Rash419
fcce324cbf admin: added retryInterval option in monitor config
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: If0b94bb043a6a4883affac6cf38adcffd3b72b9a
2023-06-29 18:21:33 +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
Caolán McNamara
2081d49bcc cid#318937 Array compared against 0
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8e0e270b0a08e9fe343b591095a001530bc88c02
2023-06-29 08:03:00 -04:00
Ashod Nakashian
7a634d0790 wsd: support providing CSP header in the config
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 25fe0b2dfb56494d59c3502f690265d46dbbc4ff)

Change-Id: I3e1f3085846ab31326a0a788e7332b5332c10c94
2023-06-19 07:45:02 -04:00
Patrick Luby
57a9db5664 Replace preprocessor directives with C++ conditional check
UnitBase::isUnitTesting() and UnitWSD::isUnitTesting() to avoid
calling methods that crash on mobile.

Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: Ie6bc2d238ac9e475b02ceef5809c55acc129dd52
2023-06-15 19:01:42 +01:00
Patrick Luby
12213d7ec5 Fix iOS build breakages by adding http::Request to iOS build
Still needed to add a bunch of #if !MOBILAPP to disable all of the
Online server's unit testing classes so that the iOS app won't crash
when opening a document.

TODO: the iOS app will not accept text input at all. Is some code
unexpectedly consuming message data sent over the mobile fake socket?

Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: Ie874ee8e452188a7b4cdf6d5f87708e5ed9b0235
2023-06-15 19:01:42 +01: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
Marco Cecchetti
d01bedc09c a11y: add config for enable/disable accessibility in general
A new section about accessibility has been appended to coolwsd.xml
config file

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I086abdf73646639283eb655ae60f200fb64e495a
2023-06-08 00:00:51 +02:00
Ashod Nakashian
cec4cf087a wsd: test: initialize logs before unit-tests
Make sure that the logging subsystem is
already initialized before starting
unit-tests.

Change-Id: I2ce3ffdb2d3b0094ae7ed496d7cacfc02af89c21
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-31 07:40:11 -04:00
Andras Timar
bd119af2bb iOS: build fix
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Idc47510f5b6c28f27b3cfac476e7a648dad03fb5
2023-05-25 09:13:32 +02:00
Ashod Nakashian
155bc06e24 wsd: de-duplicate assertCorrectThread
This merges multiple implementations of
assertCorrectThread and simplifies its
usage.

Change-Id: I7be5dea62c6046fb0412d7f885fcbcc4b66e3fd9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
9bc4b5c500 wsd: whitespace formatting
Change-Id: Id50baf8d1c539d047ba8142bfab93b445187d658
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Andras Timar
a34870d402 Add possibility to define product name from brand package
This is the product name served by hosting/capabilities
endpoint. Also, it is used by update checker.
It can be defined --with-app-name build time, but if
we would like to configure it run-time (e.g. with the
brand package), then we need a config setting for it.
E.g. brand package could execute
  coolconfig set product_name "foo bar"
in postinstall script, if necessary.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I8e72d3a3735e3a77c7aaac9a88b2c0fc6a957c0e
2023-05-17 12:53:11 +02:00
Andras Timar
a71f59c9cc Add possibility to define help root URL from brand package
Previously the help root URL was defined in coolkitconfig.xcu,
but it was inconvenient to change. Now we have this setting in
coolwsd.xml, therefore it can be changed more easily. For
example a brand package can disable the Help buttons on
dialogs by executing the following command in postinstall
script:
  coolconfig set help_url ""

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I6d0bdd71ca908df3d2dd20bd321aff9e93896f52
2023-05-17 08:26:38 +02: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
3c5a6963fe wsd: quarantine: encapsulate the quarantine path
Change-Id: I738a06b3a272a049ef8772fa0502a7f2de03c881
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
d4b27f6643 killpoco: replace HTTP status codes
We use our own status codes, which
are type-safe and use streaming
operators to serialize and log.

Change-Id: I0eba7b16694866b5a79476a7ef4b1b78f7f9c176
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-11 07:21:42 -04: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
Ashod Nakashian
6d4bb52946 wsd: minor logging cleanup
Change-Id: I1ea4f224ef2e0caee1a849abd5256521afe939bd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Ashod Nakashian
ff1657934a wsd: simplify log streaming
Change-Id: Id22de0bc06680f957e7475f142bcaf1131fdbdb9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Gökay Şatır
9d6296e4b3 Remove unused document signing code.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I30cf381d1fa282cf222ab5abc676374ab7eefb6c
2023-05-08 21:51:47 +03: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
Tor Lillqvist
bc6b3bbaee Fix build for iOS (and possibly for Android)
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I5eb5187b896b7e80aaab5660a8f10268b565dc8f
2023-04-24 17:15:47 +03: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
Ashod Nakashian
55c9280e02 wsd: multiple writes to stderr may interleave
Particularly annoying with trace level logs
when they trample over one another.

Change-Id: Ib1a8f8b8117364886af5043120e65ec7cb12e12a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-14 11:30:14 +01:00
Ashod Nakashian
9dd0636bcd wsd: announce the debug URLs to the user after server runs
The port used for client connections does change when
we cannot connect on the default/first one. There is
no point in announcing the default when we don't
yet know the actual port, and similarly it's not
helpful to do so before the server is even started.

We also move the remote-font-config thread to an
earlier point and merge it with another #if !MOBILEAPP.

Change-Id: Icc28817c7a03d49a7e130b076e545fe3ce2fb81a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-14 11:30:14 +01:00
Ashod Nakashian
3dbfce54d3 wsd: helper to dump the state of an object as a string
Change-Id: Ib49a47be2dc37663ef06ac80be981c9f3c029814
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-11 08:03:01 -04:00
Ashod Nakashian
158e1a125f wsd: avoid using the default port for unit-tests
Change-Id: I4d8681491b0aeedbc349c7644551f51052adf63d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-11 08:03:01 -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
43515fcbbf wsd: correct config default-value name for rotateOnOpen
'rotationOnOpen' -> 'rotateOnOpen'.

Change-Id: I204e1f1208cbc8089a10472fc52b4c2e83e3eaf5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-14 20:40:40 +01: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
Ashod Nakashian
58566083d5 wsd: do not warn of unassociated Kit after unloading
After unloading a document, the ChildProcess instance
may be destroyed by the time that we process the
internal prisoner connection. In that case, we
can't find the ChildProcess so we assume it was
a premature death and issue a warning.

By tracking whether or not a PrisonerRequestDispatcher
had an associated DocBroker, we can supress warnings.

Change-Id: I8bab882283f27f7d5f724e878aae19837445a2fe
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-14 15:46:48 +01:00
Jaume Pujantell
002cf9e436 Stop erasing the whole tmp directory after a download
Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I805e27df25d3134eb12926f28b6f9ff09b4ed230
2023-03-13 16:18:08 +01:00
Szymon Kłos
ffb15a2dea Send BadRequest if parameters missing
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I2acc4cb22d064994f3fca16b92b7d4528b403044
2023-03-10 19:41:16 +00:00
Szymon Kłos
3bec642b02 Add get-thumbnail endpoint
Which generates PNG of selected link target in the document

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Icfdca2f0b58ea370ca0125c188759e942aacc2e0
2023-03-10 19:41:16 +00:00
Szymon Kłos
f116a8e619 Merge extract-link-targets and convert-to request handling
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I0d3787dd33c103f128f4b16bb9b4c1d1195658c0
2023-03-10 19:41:16 +00:00
Szymon Kłos
18e304e87c Add extract-link-targets endpoint
Original author was Mert Tümer.

Example output for: POST http://localhost:9980/cool/extract-link-targets/

{
    "Targets": {
        "Tables": {
            "Table1": "Table1|table"
        },
        "Frames": {},
        "Images": {
            "image7.png": "image7.png|graphic"
        },
        "OLE objects": {},
        "Sections": {
            "Table of Contents1": "Table of Contents1|region"
        },
        "Headings": {},
        "Bookmarks": {
            "_lh2zfxamp5al": "_lh2zfxamp5al"
        },
        "Drawing objects": {}
    }
}

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Iab55ec631d78dbe25b2800ed9296bc0cb8997e97
2023-03-10 19:41:16 +00:00
Ashod Nakashian
9c39ebad1f wsd: string::empty() is clearer than size() == 0
Change-Id: If2e25d344b5718c35cb9ae7b7519010ee88f0f60
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-10 07:45:12 -05:00
Michael Meeks
4ca7070ba8 Warn and clamp unreasonable values of max_concurrency.
There are costs to many threads, and diminishing returns.

Change-Id: I4d4dc0491c48af303375d09d8eb19ffebedcad83
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-03-10 00:04:11 +01:00
Ashod Nakashian
ed341a61ad wsd: better logging around new child management
Change-Id: Id108ef7a635975bb4fd30ceb509fd2d39c3456f1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-06 08:43:37 -05:00
Ashod Nakashian
29193de7cd wsd: improved socket creation/destruction logging
Change-Id: I3f2919b646aad4c7c8b2b464155066008fbe25ae
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-06 08:43:37 -05:00
Ashod Nakashian
359017ef10 wsd: log the socket FD of PrisonerRequestDispatcher
Change-Id: I6a000e53d8baca231a2fb8f6df2251a4f57d9876
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-06 08:43:37 -05:00