Commit Graph

3039 Commits (master)

Author SHA1 Message Date
Michael Meeks 08af75d52d bgsave: add a 'finalWrite' parameter, to keep various saves sync.
Avoid complexity and wasteful creation of new processes in many cases.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If7713f80b390a8e0e53b7253244b838b325b745c
2024-05-18 17:45:02 +02:00
Rashesh Padia 35bcf56791 wsd: added config option for background manualsave
Signed-off-by: Rashesh Padia <rashesh.padia@collabora.com>
Change-Id: I76de35fe9b4135b74a96436f0c9a3245f4e00bd9
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-05-18 17:45:02 +02:00
Caolán McNamara 41dc5a6cb4 add dumping start of current and queued async dns lookups
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib40a6d1e3d6e983da674c5a7051ac5e7a565d0d1
2024-05-17 19:47:09 +01:00
Caolán McNamara c98b1c4c2b don't need to copy queue
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1e2d818c0f5b678f3de179b6fb7ce747f9e76ac3
2024-05-17 19:47:09 +01:00
Caolán McNamara 694f0488ad allow capabilities to be sent when addresses resolved async
queue addresses that need resolution, use async dns to resolve them
and when final result known dispatch the capabilities to be sent

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I13b6d0c4d47e6e8ecd06f7a449c8f808a41e5e7a
2024-05-17 19:47:09 +01:00
Caolán McNamara fc41cf7694 rearrange capabilities response to depend on allowConvertTo result
as a separate stage

getCapabilitiesJson turns out to not be called in the MOBILEAPP case
so put inside !MOBILEAPP ifdef and remove unused branch

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie144e4612aa36be88169e44d7eda7825b49a03c8
2024-05-17 19:47:09 +01:00
Caolán McNamara 594b2308f7 split out the parts that depend on dns resolution to a separate step
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2d8ab8f3c7e42d6b2f80d68861e54dca9fc4adf2
2024-05-17 19:47:09 +01:00
Caolán McNamara ff02af21d3 add Async DNS implementation
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I577af4280ac5a0a4389bb11ac6c531d846a196d1
2024-05-17 19:47:09 +01:00
Michael Meeks aefd4606f5 Fix excessive logging when a session hard quits very early on.
Enable Caolan's unit test, pass the proper 'disconnect' message
to the Kit so it can close the underlying window / resource for
the view.

Potentially this also removes 'phantom' users in the user-list
which might be another symptom of this issue.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ib0d0c5cefa7033fff5827d0a825a932cc12f8323
2024-05-17 17:36:17 +01:00
Henry Castro 3efbfaeccd browser: preview: add initial preview smile
Change-Id: Iad438677637850f8e410e7ba652a30673bea234a
Signed-off-by: Henry Castro <hcastro@collabora.com>
2024-05-15 10:13:30 +01:00
Michael Meeks dbe905de8c bgsave: enable by default again.
Seems we have closed a number of the various races and problems
seen, and this can now be used.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ie3b0a1de847b9e77820d1135b4a8facdb7934707
2024-05-14 21:28:18 +01:00
Caolán McNamara 5be3ccc871 cache DNS results for 20 seconds
querying capibilities happens frequently:

ClientRequestDispatcher: :allowConvertTo
ClientRequestDispatcher: :getCapabilitiesJson
ClientRequestDispatcher: :handleCapabilitiesRequest
ClientRequestDispatcher: :handleIncomingMessage
StreamSocket: :handlePoll
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6feb535a91f4ccc647b172da27284f26f55c3e27
2024-05-14 22:09:49 +02:00
Michael Meeks b95e4d8424 Logging: annotate WebSocket, Admin and cleanup Forkit.
Significantly calmer and less frenzied logging output.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I0f1782c0b8f10ac3427bac479ded2862f2b40b7a
2024-05-14 18:37:52 +02:00
Michael Meeks 9b6ab4c601 Logging: add Area parameter and new LOGA_ macros to annotate areas.
Add logging.disabled_areas setting to coolwsd.xml with some sensible
things to ignore unless they are warnings/errors.

Kit code duplication around logging is grim; but not fixed in this
commit.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I36bebb2b3c8d64a814d7b10c167d582de0baf4e5
2024-05-14 18:37:52 +02:00
Michael Meeks ff8dbe7fde cool#9045 - close clipboard race by waiting for completion.
To avoid the HTTP[S] request racing the websocket and sometimes
loosing we need to:

* get a notification from the Kit when the copy / cut is complete
* wait on a Promise for this, to allow the HTTP fetch to start
* re-work to do a single, rather than two fetches by sharing
  the download promise.

Change-Id: Ic23f7f817cc855ff08f25a2afefcd73d6fc3472b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-05-14 13:19:52 +02:00
Michael Meeks 1c4d71a974 cool#8747 - disable un-necessary fsync'ing.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I4d1a041f94ead329d9973aaacd85f40001417cf2
2024-05-11 19:31:33 +01:00
Ashod Nakashian 7d90faf2e4 wsd: serve all files through sts
Change-Id: I16b4d2a93ab5ec6f2a277b1b2e6be61c3515c2c8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-05-11 14:37:00 +02:00
Ashod Nakashian e546a5c602 wsd: refactor hsts header
Change-Id: I153e148bcbf9c0675d24a0b65314c6ffe4c74313
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-05-11 14:37:00 +02:00
Henry Castro 15338e91c3 browser: preview: replace meta preview place holder
It is required to initial preview place holder,
otherwise, there are some cases that the server takes
time to serve preview_placeholder.svg and it may cause
an ugly effect.

Change-Id: I70ac46c8c464b64a09f091cdf5f8644d208a79d4
Signed-off-by: Henry Castro <hcastro@collabora.com>
2024-05-10 14:58:19 +01:00
Michael Meeks 7f6b59b180 bgsave: improve unit tests.
Force background saving in the config for this test.

Use stamp files to force sequencing between Unit test and Kit.

Change-Id: Ia2c60c3dcfdad87c9c9754e8f20a3c36dbcf74d5
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-05-08 16:42:29 +01:00
Rashesh Padia 7572af7486 fix: don't wait for migrate msg if indirection server closes the connection because deployment gets deleted
- if deployment gets deleted than there is no where to migrate the
documents in such cases indirection will close the monitor connection
but we need to set the _migrateMsgReceived flag so that docBroker don't
wait for the message and continue to cleanup the document

Signed-off-by: Rashesh Padia <rashesh.padia@collabora.com>
Change-Id: Ia2732740927ea16e368f91bea7421576a3cf2beb
2024-05-07 20:26:46 +05:30
Rashesh Padia c1f0fcf946 indirection_server: migrate document on shutdown
- when COOLWSD get SIGTERM admin sends a "shutdown_received" message to
indirection server
- indirection server sends back migration messages for each document to
migrate it other available COOL server
- there is timeout associated with migration message if COOLWSD doesn't
get message we move on and close the document
- added a new option in coolwsd.xml to change the migration timeout
default is 180s

Signed-off-by: Rashesh Padia <rashesh.padia@collabora.com>
Change-Id: Id7d5eea94d1b03ea5905ca67a9dd8f6ca15952f3
2024-05-07 20:26:46 +05:30
Hubert Figuière 22e789a420 impress: restrict presentation in readonly mode
When export is disabled or watermarks are enabled, presentation in readonly mode
is disabled.
This is checked in the frontend by the WOPI property `DisablePresentation`
that is synthesized in the wsd. Also check when calling the presentation
command.
WOPIFileInfo::getWatermarkText() is stubbed on mobile.

Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: I4f7aff9f670f7523dfcf396f6009a272df9d5af8
2024-05-07 13:21:04 +01:00
Michael Meeks 90f387cdc5 bgsave: change statusindicator protocol message to 'progress' + JSON.
We need to get more helpful structure into this message, and add a
type=bg flag to handle background progress messages.

Add unit test for merging progress: setvalue commands.

Simplify ProtocolHandler sendTextMessage with a std::string wrapper.

Android code needs manual testing.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I54ce807e2fc5de80118905e68557a95e637fbd18
2024-05-06 20:28:08 +01:00
Caolán McNamara 2546252d31 disable watchdog during Document::updateMemoryDirty
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5358ec0df536c4b3c302011869b42db3491ce73e
2024-04-30 17:55:13 +02:00
Michael Meeks d2dae8f2b5 Fix broken conditional compilation for WASM.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ib0f3733a0719c87281b432c7c009fc2362ad3cce
2024-04-29 10:56:54 +02:00
Michael Meeks 12310c7dec test: allow an exitTest to work in Kit and propagate its result.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I0d32d46e81eb3ed42d8531860ef2d8e06bdca591
2024-04-29 10:56:54 +02:00
Michael Meeks a866719881 test: abort a test whose kit has a segfault by default.
Otherwise forkit tends to loop aggressively re-starting that for the
duration of the test wastefully.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ia1c684a5d995f54f29290c9631b1ee14266445d7
2024-04-29 10:56:54 +02:00
Aron Budea b38e1f41ea Don't log warnings about version mismatch for admin console
It's only relevant for regular URLs that contain version hash.

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I73afaa0559c3dddc09a8ed5f786fb5126e1c8f0c
2024-04-27 06:52:04 -04:00
Michael Meeks 1b6af5e28d killpoco: remove lots of redundant JSON includes.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I976c5b8d6763cbbf0ee5cadfa2f7335ec719fe85
2024-04-25 09:06:13 +02:00
Michael Meeks 884a841cde Logging: wrap poco and simplify logging.
Centralize more logging functionality in Log.cpp, simplify and
wrap underlying logging APIs better.

Code is much more generic, and hides implementation details
much more thoroughly, while keeping the same API / wrappers.

To do this we have to sub-class Poco::Logger to get access to
its generic 'log' method instead of a mess of in-line wrappers,
this lets us avoid lots of code.

Change-Id: I541d3aef49f99ce582655c5102a0041bf84cd56a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-04-24 10:59:51 +01:00
Michael Meeks 9085ff7580 Improve DocumentBroker state dumping.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I091c67d8b72bcaa3d82cd4de7be9d5ceb8d9720d
2024-04-24 09:24:34 +01:00
Caolán McNamara 843b286d8c cid#360695 Dereference after null check
<< precedence is higher than ?

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie7a77ba949195b91df3b87059c0c458c57b2be94
2024-04-23 14:30:42 +02:00
Caolán McNamara e6de6b9f93 cid#318937 Array compared against 0
this returns the same type as its 3rd arg, so using "false" returns
a const char* and not a bool

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibd46ecea82ef4587e1a2083430981976457ab874
2024-04-23 14:30:42 +02:00
Szymon Kłos 01a30b03f1 Allow to embed the presentation in window
Similar like in:
commit d9d13d7092
wasm: support serving wasm files

add headers required when we use WASM so we are able to
embed presentation in window.

Without that we get:
not-set Cross-Origin-Embedder-Policy

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I03ca3717488a92fe405693764f3f18a964b23bf7
2024-04-23 11:52:48 +02:00
Michael Meeks 7f7d901726 bgsave: default to background save off on upgrade for now.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I7cfceb1288dc2e05438653f3cedc9b7d32bc5fb8
2024-04-18 20:18:07 +01:00
Ashod Nakashian 1e206ac001 wsd: allow for recovering from unloading document
When the last connection is closed, we flag the
document for unloading, until we save and
unload and have nothing further to do. However,
if during that time a new client joins the
document, we reset the unloading state and
recover.

A previously failing and disabled test is now
re-enabled and passes.

Change-Id: I425a9286ec5df56064132e5e4227227761c65830
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-18 10:05:06 -04:00
Ashod Nakashian e690a739da wsd: support synchronous CheckFileInfo
In certain scenarios, such as with Proxy.php,
we don't have CheckFileInfo in advance and
need to request it before proceeding further.

This adds a wrapper to wait for the
CheckFileInfo request to complete.

Change-Id: I8afa955f841899eb667c02168a29a68c1dffb21b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-17 10:18:33 +02:00
Michael Meeks 030acb1a85 bgsave: Add SLEEPBACKGROUNDFORDEBUGGER environment variable.
Change-Id: I7284d03ddcd79a0848d1cca9b219e2ef96548511
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-04-17 08:35:30 +01:00
Michael Meeks af749c2237 bgsave: rename parameter to background, and add setting.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ic49ec5715682b71461b49741d022fc7149aa5a13
2024-04-16 16:43:52 +01:00
Caolán McNamara ce437ce41a cid#360691 COPY_INSTEAD_OF_MOVE
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I19c77888eabd7ea6c1186d3a3a30e6913826a641
2024-04-16 15:19:35 +02:00
Caolán McNamara 2d5797ad4b cid#360692 Uninitialized scalar variable
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ica6d5a202c1124680ae5ab01bd551fc800a74910
2024-04-16 15:19:35 +02:00
Caolán McNamara 7f4fd7f556 cid#360695 Dereference after null check
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic7d9fe40440d9a6d31b6f546270ab36acfa24d4a
2024-04-16 15:19:35 +02:00
Caolán McNamara fa994b2177 cid#360699 Uninitialized scalar field
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I578424a95b728d285924b78679d9ec23ad53972b
2024-04-16 15:19:35 +02:00
Caolán McNamara b88d518622 unwanted extra quote at end of true in json
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I66d80d415ea8e19823ccb7e6b3e8b6af1df51fbc
2024-04-16 12:04:17 +02:00
Méven Car fb96ec89a3 WopiStorage: turn err to warning logging for PutFile
Let the error detail the error origins.

Signed-off-by: Méven Car <meven.car@collabora.com>
Change-Id: I67a98dfe1001fd663af464ec5ec417330d0fbfb1
2024-04-16 09:24:42 +02:00
Michael Meeks 0b3b27cb72 bgsave: switch to using a 'save' command to the kit.
Also pass 'autosave' status in a more conventional way.

Ideally we would split 'save' away from a ChildSession / ClientSession
and have this on DocumentBroker / Document - for the future.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I39a6caf8b17fa2fc2d940ae0d11bdc2d4da20b6c
2024-04-15 11:06:22 +01:00
Aron Budea 246e87fea2 wsd: Unconditionally compile support-key-enabled code paths
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Iec477c223f2dc75e0be8b472c8439ca9311d6aae
2024-04-14 01:23:00 +01:00
Ashod Nakashian 980136ebf7 wsd: always create wopiFileInfo
We need to have a valid wopiFileInfo instance
even on Mobile, since we dereference it
to get the actual unique_ptr.

Eventually, we should change this to be
a shared_ptr everywhere, but until then
we need to make sure the pointer is valid.

Change-Id: I54b6a0f862e319f4e727c28ac396102410bb422d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-12 13:16:58 +01:00
Ashod Nakashian f3b10c3790 wsd: make checkFileInfo call explicit
When we call checkFileInfo from the constructor
of CheckFileInfo, it is possible for the
callback to get fired immediately if we fail
to open a socket.
In that case, the caller would have had
no chance of having stored the reference to
the CheckFileInfo object instance, so
the callback would fire without the owner
having a way to properly do housekeeping.

By moving the call outside of the constructor
and making it explicit, we allow for a
better management of the CheckFileInfo
object instance.

Change-Id: I3094b73fa3ab70e83ec5238959defcb2fd9ecf4e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-12 13:16:58 +01:00