Commit Graph

3058 Commits (master)

Author SHA1 Message Date
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
Michael Meeks 144b701453 cool#8703 - Drop random node creation and rely on inherited fd.
Re-using an inherited file descriptor to /dev/urandom frees us
from problems with mount options including 'nodev' and removes a
capability from the set we need.

Change-Id: I70337e923f802d7efbd3159c11a4e39f6529b6e6
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-04-07 12:11:48 +02:00
Michael Meeks 9ba05ccbe6 Reduce C++ requirement.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I640230950cabd93bf12c86750f6aa6c95eb05021
2024-04-03 22:38:08 +01:00
Ashod Nakashian 958f4b0f55 wsd: merge downloadAdvance with download
Change-Id: I0f9ad626c78e81896e42f5a431b0f209a77f563a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 64b4339e00 wsd: pass uriPublic explicitly to download()
Change-Id: I7c333c83598c2a4847efcd96cd59bc595cdae49f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 25d10bf490 wsd: simpler downloadAdvance interface
Change-Id: Ibd8ba73b2f4e926cc078e66f53766ee99478f9d4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 72c368ea0e wsd: refactor the download logic in DocumentBroker
Change-Id: Ic916a8373664f2b4de8d8649bf160effb1fe3dfa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian b2c980a91a wsd: refactor setting wopiInfo into the session
Change-Id: Id2850c43843cbb418e7c188efcd6d2e6bf652165
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian deb60c095d wsd: simplify uriPublic in DocumentBroker::download()
Change-Id: I5ca31e08716db4c0a47a952b89e6529b330b6370
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian e9591cfa25 wsd: pass uriPublic explicitly to downloadAdvance
Change-Id: I0ac6f32894ada50be59e9801b68a1918affd6a9e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian ac589f5563 wsd: formatting
Change-Id: I365121f2ccfc1bf1f73f4f8e41a8d84e920da1ce
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 577c1fb0d3 wsd: refactor the plugin processing
This reduces code duplication and makes
the code more readable by extracting
the huge block that processes plugins.

Change-Id: I2dc243173a4122ae1d5fc5b3fa2b40daff9664e4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 04526159df wsd: minor formatting
Change-Id: Ibe9d9d946fc9aba1b2ac754ef952dc6adda47961
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +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 ec2e9ccdc3 wsd: CheckFileInfo parses the JSON response
Change-Id: I5a9cd984930c6312de9088acd39b83acf1c07eb9
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 de985834e2 wsd: simplify DocumentBroker construction
Change-Id: I5e908f0f5aed9146e14175eb79335fe9c80db2f2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-04-03 14:26:28 +01:00
Ashod Nakashian 062574341f wsd: move wopi stub/dummy interface to MobileApp.hpp
Change-Id: I58ac7467c4e74059e4de08c914546614ed6fe883
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 8e14087ef1 wsd: Support ahead-of-time document loading
Change-Id: Ia1cc7e42f7eea530097a37cce723b8833b998357
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 708e4a7746 wsd: uninitialized member
Change-Id: I2eefc58eb0105999277114c70c2b17bf3a615ccd
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 9148996509 wsd: simplify findOrCreateDocBroker call
Change-Id: I8765b887d6fde34bdbb8ff361af6636d494f2ddd
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
Parth Raiyani c9ef8c3015 Removed Group download as option from coolwsd.xml
Signed-off-by: Parth Raiyani <pmr642001@gmail.com>
Change-Id: I47c07ed88d68de5fc65b2e5e1e0896bc2a082131
2024-03-29 15:07:07 +01:00
Michael Meeks 80eeabb1a6 Watchdog: expose global watchdog thread.
This will enable thread joining before fork for bgsave.

Change-Id: I68c7c53f892f5edef861137c48759c7ccb8532ab
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-03-29 13:04:09 +00:00
Michael Meeks fd77301ebb polls: switch compiled in delays to 60 seconds.
Forkit forking children is done in response to socket messages,
and parent process death should kill us too.

In general if we are relying on a poll to spin to achieve
something, we have a performance bug; this should exacerbate them
to flush them out.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I60d1c3b3c2532bbd686a3d3cfdea10f2a541a19a
2024-03-25 08:18:35 +00:00
Michael Meeks 005ba1567e PrisonerPoll - leave unused Kit sockets in the poll.
This lets us detect when Kit processes die without waiting for
the poll() timeout and feebly spinning the PrisonerPoll loop.

Instead we get notified immediately; but to do this we then need
to be able to safely transfer the socket between SocketPolls.

SocketPoll's should own Sockets - so by switching ChildProcess to
use a weak_ptr and also the NewChildren list - we can have standard
ownership and a sensible transfer between SocketPolls. A Socket is
owned either by PrisonerPoll or a DocumentBroker in the normal way.

Clean the NewChildren list as/when children are unexpectedly killed
apparently there are still some ownership issues probably around
the strong ChildProcess _ws pointer.

Change-Id: Ie541a9d03e36aee53fd57c45953e0de21ebe1828
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-03-25 08:18:35 +00:00
Ashod Nakashian 5880312981 wsd: fix support-key build
Change-Id: Ib59494884333a200d768eec8b829e565f6470e2a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-23 09:47:44 +10:30
Miklos Vajna f9fe3c1880 Related: cool#8023 wsd, ClientSession: fix bogus <body> warning with plain text
E.g. unit-copy-paste emitted a warning like this:
wsd-1576653-1576734 2024-03-20 21:28:53.448488 +0000 [ docbroker_002 ] DBG  ToClient-005: Missing <body> ...

This is a real problem in case the clipboard has HTML, but it's fine
when the clipboard is just plain text.

Fix the noise by returning early when the body of the clipboardcontent
message contains just plain text.

This works because the body never starts with plain text when HTML is
also available: the JSON case is not an issue and the entire clipboard
dump lists HTML before plain text.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I1ff51249fb710e3a9c127917aae4178c22738668
2024-03-22 08:32:41 +01:00
Miklos Vajna b14f3fffff cool#8465 clipboard: improve handling of plain text copy, complex case
In case the selection is complex (not simple), we used to just request
HTML, and then the browser converted that to plain text, which has the
downsides already mentioned in commit
7f9de46688 (cool#8465 clipboard: improve
handling of plain text copy, simple case, 2024-03-08).

Steps to support this:

1) Clipboard.js now asks for the text/html,text/plain;charset=utf-8 MIME
   types.

2) wsd: ClientRequestDispatcher::handleClipboardRequest() now maps this
   to DocumentBroker::CLIP_REQUEST_GET_HTML_PLAIN_ONLY

3) ClientSession::handleClipboardRequest() maps this to the HTML+plain
   text MIME type list.

4) kit: ChildSession::getClipboard() is now improved to take a list of
   MIME types, not just 1 or everything.

5) kit: ChildSession::getClipboard() now emits JSON in case not all, but
   multiple MIME types are requested.

6) wsd: ClientSession::postProcessCopyPayload() now knows how to
   postprocess clipboardcontent messages, which may or may not be JSON
   (it's JSON if more formats are requested explicitly, leaving the 1
   format or all format cases unchanged)

7) Control.DownloadProgress.js now handles the case when we get JSON and
   sets the core-provided plain text next to the HTML.

   Leave the handling of non-JSON case in, because this means we can
   copy from an old COOL server to a new one.

Note that this approach has the benefit that once the clipboard marker
is inserted, the length of the text/html format would change, which
means we can't parse the clipboard data till the marker is removed.
Emitting JSON for html+text means adding the marker keeps the ability to
parse the HTML and the plain text part of the clipboard in JS.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I67a1f669e8a638d34cc25a2f288a7b30884b9892
2024-03-20 10:21:59 +01:00
Jaume Pujantell 8921e19d84 reduce uses of MOBILEAPP on some files
Reduce the uses of MOBILEAPP conditionals by using the isMobileApp
function.

Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: If541307fbc457b342674cc560b6c53454f3904cf
2024-03-20 09:13:00 +01:00
Ashod Nakashian 0241aa5aca wsd: use http::Response in FileServerRequestHandler::preprocessFile
Change-Id: I5afa5d8b56017568f02e7ed5cd6cb93df12d895e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 4387168d94 wsd: reuse the response in FileServer
This allows for setting common headers
only once and have it on all file
types and scenarios.

Change-Id: Ia9d67ac5dbf59dd6e22beea0b4ae162ccb846b33
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian a48917d052 killpoco: use http::Response in admin file serving
Change-Id: I9ad49002bc85071770aba08c23e0210bb10ff55b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 4dfb7ee312 killpoco: use http::Response for Admin metrics
Change-Id: I86eed98061bdb24d4bca8de452e4d4f925f27e93
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 882350ed70 wsd: remove sendWithDateAndAgent
The explicit header entries were needed
with Poco, but since we always set them
in our http::Response constructor, these
are redundant.

Change-Id: Ifde48fd3048018747dae3e84560b31960e511a25
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 7fb6ccf4ee wsd: remove duplicate Server and Date headers
We always create http::Response instances
with these headers. These explicit entries
are vestiges from Poco sockets.

Change-Id: I65c263e95b253e22e4e6deae57fffc5616311c84
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 00d483f67d wsd: minor cleanup of Admin::getLogLines
Change-Id: Ic238dcb7996c2967355366c062f0b94912d7adc7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 0a78d691ab wsd: parse config only once in Admin
Change-Id: I7b21f526145abd7f16eb4da8b2d4784798cf8b9b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 0ffdc19b3f wsd: simplify jwtToken extraction
Change-Id: I190817a0086d762bacfadac76b5edacbdf84dc12
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 727beabc94 wsd: simplify isAdminLoggedIn
Change-Id: I9ec2a585b2256882ee89ee6479a752735927e678
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 355dfdd58a wsd: add authenticateAdmin helper
Change-Id: I183ddef3378e19ce43845aa73804fe8c142e8e0e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian f034709b69 wsd: include cleanup
Change-Id: I9e63d673b25ac29f8070a81b35e5def96d6a165f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian ccb29243c6 wsd: move stringifyBoolFromConfig to anonymous namespace
This is an internal helper and doesn't need
to pollute widely used headers, especially
that it pulls Poco headers with it.

Change-Id: I67a5aa64589d3f37141aff612f7fb807bb190d6f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Ashod Nakashian 41abc931dc wsd: new isAdminLoggedIn that only verifies a valid token
This helper doesn't implicitly authenticate the
user and generate a JWT token.

Change-Id: Ib32ba4c73948c12bf41520e32e6a16da0e9cb425
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-19 20:51:02 -04:00
Michael Meeks 5105e4202a unipoll cleanup - remove obsolete DocumentBroker mutex.
This should not have been necessary for a long time; but add
some assertions to help check.

Change-Id: Iedbc0bb57839209d1f1caeaab7094e335c881e57
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-03-19 20:44:59 -04:00
Rashesh Padia 464358ca70 fix: data loss when shutting down while using typer
- Docbroker only uploads the document when the document is already saved and
  there are no further modifications.
- But when using typer once dockerbroker saves the document and tries to upload
  there are already new changes to the document. Therefore, docbroker keeps on
  saving this new changes and keeps on skiping the upload as there are new
  changes to the document; until it times out

Signed-off-by: Rashesh Padia <rashesh.padia@collabora.com>
Change-Id: I427d37a6228299006530daddebdf4365af63588b
2024-03-19 19:42:20 +05:30
Michael Meeks c1b6b5d30f Watchdog to call probe-point when SocketPolls are slow.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Id58efab0c0fee88a3da094765eb6b7641aec6e02
2024-03-19 11:29:07 +00:00
Ashod Nakashian 8b97c4527e wsd: add ProfileZone to WopiStorage::uploadLocalFileToStorageAsync
Change-Id: I17a4a96f0ffbf4a230e7c5a0234782555fc06320
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-18 18:41:49 +00:00
Ashod Nakashian f2c35e2435 wsd: support ProfileZone in CheckFileInfo
Change-Id: Ifd4608bbb9db119bbaeb2820f2d151597e41a479
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-18 18:41:49 +00:00
Ashod Nakashian 21b0394828 wsd: better empty string operations
Change-Id: Ic14efcaa8a1c345b875c27446b16f51740c55efa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-18 18:41:49 +00:00
Ashod Nakashian 57b7626531 wsd: only ever issue one RVS per request key
If we get an identical request while already
processing an async CheckFileInfo (while
serving cool.html), we shouldn't clobber
the old instance and issue a new one.

Change-Id: Ie6da4ab780d581db74430dedd6d307a4ac2e0a0b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-18 13:47:58 +00: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
Gökay Şatır c127d54919 Send permission parameter to wopi parameters.
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I0a779e7f27196ca987b11a619c9b0ee27a87bb4a
2024-03-16 07:28:30 +03:00
Gökay Şatır 27670275ab Send isAllowChangeComments flag to ChildSession.
We also set the variable on the core side in order to allow saving edited documents.

Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I9ba97daca7013bf26b25fff785f175e3fb213dfb
2024-03-16 07:28:30 +03:00
Gökay Şatır ea7c9c9fe6 Check session->isReadOnly along with getUserCanWrite.
This allows permission=readonly URL parameter.

Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I02df9723cf90c961be2e8ce579304355420d0d11
2024-03-16 07:28:30 +03:00
Ashod Nakashian c121488a67 wsd: WopiStorage cleanup
Remove MOBILEAPP directives and create
stub WopiStorage and WOPIFileInfo.

Change-Id: I57cd5a008d625ac53ef23c4bb3872381af35560c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-09 12:37:19 -05:00
Ashod Nakashian dacfb65965 wsd: move WopiStorage to own home
Change-Id: I622c6c1230f7c1248c7b432b6d1b56bff4cacb9e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-09 12:37:19 -05:00
Ashod Nakashian 55b3ad962a wsd: SPDX-License-Identifier
Change-Id: Ia174022aba50c8655ff758958b517b4a47615aab
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-09 12:37:19 -05:00
Ashod Nakashian d57baeb906 wsd: reduce directives for unused variable supression
We use [[maybe_unused]] to reduce explicit supression
especially under compile-time directives.

Change-Id: Ic5f3f3227a80efe52097cb35520d05b9cdaacb42
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-09 12:37:19 -05:00
Ashod Nakashian 4a3e10e4a9 wsd: reuse CheckFileInfo in WopiProxy
Change-Id: I926b8ad6f9035dda4061e8e1d6065a39e772862a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-09 12:37:19 -05:00
Ashod Nakashian 11422c5340 wsd: move WopiProxy to wopi/
Change-Id: I5ec7bfe1c5295c3d17979dc5aaa2806259c6af9d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-09 12:37:19 -05:00
Gökay Şatır a1d0745de5 Add sample URLs for readonly mode to console output.
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I2e10a25850a64bb666d0473d8881878ff41ad6b1
2024-03-08 17:21:51 +03:00
Miklos Vajna 7f9de46688 cool#8465 clipboard: improve handling of plain text copy, simple case
Currently the current selection is always requested as HTML by the
browser, and then we ask the browser to convert it to plain text.

The problem is that e.g. Writer can produce much better plain text from
its model, compared to the plain text by the browser, e.g. bullet
characters for bullet points.

Fix the problem by:

- CanvasTileLayer.js, _onTextSelectionMsg(): requesting both HTML and
  plain text. Use ',' as a separator, as that's already established,
  e.g. the HTTP Accept header does that already

- Switching the textselectioncontent protocol message from just HTML to
  JSON that contains both HTML and plain text. This is produced in
  ChildSession::getTextSelection() and parsed in CanvasTileLayer.js,
  _onMessage()

- Clipboard.js, setTextSelectionHTML(): allowing setting both HTML and
  plain text.

- ClientSession::postProcessCopyPayload(): knowing if the content to be
  processed is HTML-in-JSON or just HTML, do additional escaping in the
  JSON / textselectioncontent case, but leave the other clipboardcontent
  case unchanged.

So far this only handles the simple case, the behavior for complex
selections are left unchanged for now. The payload is also unchanged
when a single format is requested, as many tests depend on test.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I2fe1378a8d50b7901ac9e808eb78858cd8ff8575
2024-03-08 13:54:10 +00:00
Gökay Şatır 9e2aa171c4 Allow some of the interactions in readonly mode.
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I57c697e3493a92e9b77adbb2a389417b6d5ce5bc
2024-03-06 14:03:02 +01:00
Gökay Şatır bf7ce2b086 Allow events through core side on readonlymode.
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I4ff02b96f0019aa794834c824de0d1a323a00c7c
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
2024-03-06 14:03:02 +01:00
Gökay Şatır 1354d23a2f Revert "Changes for handling readonly mode click events:"
This reverts commit 924f13f106.

Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
2024-03-06 14:03:02 +01:00
Neil Guertin 8717fa6d90 Fix for unit-httpws failure
Fix race condition in testSaveOnDisconnect by waiting for kit process to
stop instead of just counting total kit processes

Signed-off-by: Neil Guertin <neil.guertin@collabora.com>
Change-Id: I6bda6b114070123a1366bc04eac1873f19928ac0
2024-03-06 09:10:32 +00:00
Szymon Kłos 17015c1109 lok_allow: remove also port
Noticed in some k8s deployments where alias groups were
defined with port. For lok_allow we need only host name.
Avoid adding empty hosts.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ic9cd574f9b6faa3c382229a853883a128e9b0620
2024-03-06 08:47:28 +00:00
Ashod Nakashian 7b0d87e47c wsd: move StorageConnectionManager into wopi
Change-Id: I1d606f1ccf0c9bc95dfc8b0fa88d082f2c123127
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-05 07:10:34 -05:00
Ashod Nakashian af29ad28b0 wsd: log the previous upload attempt result
Change-Id: I11a338024e18b72983c205f6afe02883b5d69398
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-05 07:10:34 -05: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 317397eaac wsd: new CheckFileInfo class to do async requests
We also create a new sub-directory for WOPI
code, which helps better organize things and
isolate it from Mobile App builds, which have
no need for it.

Change-Id: Id6dbbd450f35c9c0eb8460de12330cff2e3e5576
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-05 07:10:34 -05:00
Ashod Nakashian 1896baa539 wsd: test: use STATE_ENUM in tests
Change-Id: Ie37bfdb7aba986dc17c1ebaac80d9b1b662a5df6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-05 12:21:50 +01:00
Ashod Nakashian 2e8561195c wsd: move deprecated logic under legacy_server config
We no longer send LOOL-WOPI headers, unless
the configuration specifically flags for
legacy servers. But we always send COOL-WOPI
even to legacy servers, to help them upgrade
seamlessly.

Change-Id: Ifc919ed8f6665cd8f846117ef4e8b7ef09fbd563
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-02 04:02:26 -05:00
Noel Grandin 8a8e55c16e replace Poco in StreamSocket::send
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Change-Id: I987cc515e27fbaf4e778a5ac6f005a43ff88be71
2024-02-27 13:17:12 +00: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