Commit Graph

34 Commits (master)

Author SHA1 Message Date
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 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
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
Ashod Nakashian 96bfccd5ae wsd: remove MOBILEAPP for parsing CheckFileInfo json
Change-Id: I72b916d9ed9266afca21934278f8d01c1d97928e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 84fd030707 wsd: DocBroker with wopiFileInfo
Change-Id: I32c7be67a191df063f97d3c5d7f20ba2a57256da
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 4c19afdd01 wsd: capture the file size in StorageBase::FileInfo
Change-Id: I842c730a51cbb336e108f26e717a17b12f12eb49
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 9782e3eea9 wsd: more accurate load error message
Since we have a more accurate reason
for failing to load, that's what we
should always return.

Change-Id: If9d38cf6de6d41310ba94857efcd073e3f4ef8b7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 21c3b4d3ed wsd: merge single-use findOrCreateDocBroker overload
Change-Id: Ib8087891d793effa3192b4a2b893733eec275f40
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 6bed4e631b wsd: create DocBroker once CheckFileInfo clears
Change-Id: Ie38070b9e8bddd7d546070a00c8bf3779f6e8cf4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 034ea8b290 wsd: structured binding in findOrCreateDocBroker
Change-Id: I3387ff00cf11d848bbd24d490f879a17471d7f7c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian f38f5edd7d wsd: move overloaded findOrCreateDocBroker to RVS
Change-Id: I6a35a49ef3631769c4c38f8c63f86ce3e51aa695
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 042e4366ef wsd: cosmetics
Change-Id: Ib5fd54abcda44ce8c62171cbbf8c51ffcd530344
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian d6f528a4d3 wsd: check if we already have a WS in RVS
We might not have the WS yet when
CheckFileInfo fails or returns unauthorized.

Change-Id: Id0fe34a6fadef7ba4094707a0ae82b83b9b2a5fb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-18 13:47:58 +00:00
Ashod Nakashian ed753e16d2 wsd: use new CheckFileInfo class in RequestVettingStation
Change-Id: Iafcf965c98027fa2b5ffe4db5bd1fd5820c47f23
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-05 07:10:34 -05:00
Ashod Nakashian 2d31aafa11 wsd: fix assertion and better logging
In some cases the WOPISrc is inconsistently
encoded. So now we decode before comparing.

Also, improve related log entries.

Change-Id: Ifd6cca76c91a34761dd0ce8f6d78c3af5d47fd43
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-26 18:24:32 -05:00
Ashod Nakashian f4707aac13 wsd: split createDocBroker into createClientSession
We only need the client WebSocket when creating
a new ClientSession. As such, we can spawn the Kit,
create a new thread, and even download the document
before the said WebSocket is connected.

At this point we only refactor the createDocBroker
helper.

Change-Id: I1bb57f6f0f2e89d49266cb87f152970a47e1eecf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-24 14:09:22 -05:00
Ashod Nakashian 1dc205186a wsd: better logging in RequestVettingStation::handleRequest
Change-Id: Ic76aab4909c682df8739e2e1de8aa00832387d77
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-24 14:09:22 -05:00
Ashod Nakashian 84aa1a44e8 wsd: parallel load with cool.html
Support parallel CheckFileInfo upon serving
cool.html. This makes loading documents faster
from the user's perspective by parallelizing
CheckFileInfo and, later, DocBroker creation
and document downloading.

Change-Id: I838a19022517196ee2b459991a542ed9ef323e48
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-24 14:09:22 -05:00
Ashod Nakashian 789eb6fa52 wsd: make wopiInfo a member of RequestVettingStation
Change-Id: I74eaaee3a5afc30ee89d16a83f89d3f471bd1f09
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-24 14:09:22 -05:00
Ashod Nakashian 32ba3e34b5 wsd: restructure RequestVettingStation interface
This makes it easier to support even earlier use
of RequestVettingStation, when cool.html is served.

Change-Id: I206f5f593a33806c24c6ed1e126d4cae5500f405
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-24 14:09:22 -05:00
Caolán McNamara 71a427c465 cid#344351 COPY_INSTEAD_OF_MOVE
and

cid#336280 COPY_INSTEAD_OF_MOVE
cid#318848 COPY_INSTEAD_OF_MOVE
cid#318964 COPY_INSTEAD_OF_MOVE
cid#344354 COPY_INSTEAD_OF_MOVE

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I60a904be4b5edf61cfd5b2efab81e5c1a089b661
2024-02-12 11:12:33 +01:00
Ashod Nakashian a449b8d229 wsd: simplify WebSocketHandler::sendErrorAndShutdown
Socket::shutdown() already does ignoreInput().

Change-Id: I75004ae881c481440d3e3cd31a96ba75ddbad22d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-09 15:50:50 +00:00
Ashod Nakashian 3a109537ee wsd: exclude WopiStorage in mobile builds
This excludes Wopi handling (as much as possible)
from mobile builds.

Change-Id: I4abb00f02e77b5d89d56ced49ce19a37ae93c13e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-09 15:50:50 +00:00
Ashod Nakashian 3585e7ed83 wsd: rvs: copy the WS before passing it to docBroker
Change-Id: Ie1b995b551453e871da19b13888b1e80ff6643b0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Ashod Nakashian 8358fc2293 wsd: rvs: refactor send error and shutdown socket
Change-Id: I0a32dec86e3e9b9b5989da40a25af90ba9b82095
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Ashod Nakashian 37efb14d35 wsd: rvs: avoid exceptions when handled gracefully already
Throwing exceptions from an async processor does
nothing good. Instead, we handle the consequences of
the error in-place, instead of throwing.

Change-Id: I85c4cee7cc8231453498e4cb9cb07a07b2b417c9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Ashod Nakashian a3dcf28bed wsd: rvs: better logging
Change-Id: I56df3835d74502590a5e0104c5dcbee6ad26d827
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Ashod Nakashian 6fe96901c9 wsd: rvs: support redirection of CheckFileInfo
CheckFileInfo requests can now redirect
to a new URL.

Change-Id: I7579ac37235b1a2ac1d7091366f0046cf889ce15
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Ashod Nakashian 1f3441cc42 wsd: rvs: refactor CheckFileInfo
This breaks the CheckFileInfo fetching
code in RVS into its own function to
allow for redirection.

Change-Id: I8bfa3a71705c77af8f6e75ed1af75e710767cf19
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Ashod Nakashian 1164cb90fa wsd: rvs: pass wopiFileInfo around
Change-Id: I52ef794d758a06d66cb91cc7bdb272bd2167b05c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Ashod Nakashian 2063b1ba50 wsd: rvs: handle StorageSpaceLowException
Change-Id: I036c577716cc0ba38c9585e6d1009c7ba82a87a3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Ashod Nakashian 91029b0efd wsd: rvs: refactor createDocBroker
Change-Id: Iaff50d505aa054a1f13c71a60a247feaede54172
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Ashod Nakashian 5c5c4559f9 wsd: rvs: add RequestVettingStation
RequestVettingStation is designed to
vet requests before allocating further
resources. Specifically, it is to be
used to verify whether the resource
requested exists and whether or not
the request is allowed and authenticated.

All of this is designed to be done
asynchronously, for performance reasons.

Change-Id: I399fa7bc91741ffee065a6d41acca0756eedc939
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00