Commit graph

1950 commits

Author SHA1 Message Date
Ashod Nakashian
965e5cb37d wsd: verify that the last-editing-session can save
The last-editing-session could still be valid, but
waiting disconnection, in which case the kit might
have already discarded it, and so saving would
fail (silently, and thereby leaving docbroker
waiting for the save response).

To avoid this, we always validate the
last-editing-session before using, and not just
when setting it.

Change-Id: I60cd219d8e5a9945396110c8f8d194e87f81afba
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit e1fc6adbfef7ee0678c7a563fd6142c32f2da4a6)
2021-09-26 17:02:01 -04:00
Ashod Nakashian
b82b18e8c9 wsd: autosave using the last editing session
Change-Id: I556b7b49b2d1abc0e61ea7ecaa8e5f9406c408f3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit b3738719a3b7301688faecfd721a97180eab0020)
2021-09-26 17:02:01 -04:00
Ashod Nakashian
ff1ff12663 wsd: each view handles its own url params
Change-Id: I0c6b9b86c970b1f45e7fa34d030f08c6f256d082
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit d4aa0a0f73eef5a90a14a2297f3050c1dba95a2d)
2021-09-26 17:02:01 -04:00
Ashod Nakashian
d395f521df wsd: log stopping-although-modified as warning
This log entry can be misleading on its own.
When shutting down, the modified flag is not reset,
and that in itself is not a cause for concern.
So this log entry is seen much more often than we
expect. If we truely fail to save/upload, there
will be other errors that will be the tell-tale
signs of a serious issue. So it's reasonable to
downgrade this error to a warning (and watch for
other errors).

Change-Id: Ic879c3fbac887ed5b64bdd1a31aa38bcfd863850
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 7db86b3eb2cdc2a44023e7b7491e1ee202146ef5)
2021-09-26 17:02:01 -04:00
Ashod Nakashian
2b95acb153 wsd: close the upload socket if exit-save
When we are uploading before exit we don't
want the upload socket to linger, because
that would keep the SocketPoll alive for
longer than necessary, holding up the DocBroker.
Instead, we flag the socket for closure, right
after that single request, via HTTP headers.

This allows for very fast unloading of the
DocBroker right after uploading.

Change-Id: I926763383093d2d2dfb10ed41293b1f5d54d090b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 4e132606d1849f82991c46d641c50794d632233c)
2021-09-26 17:02:01 -04:00
Ashod Nakashian
c4fb58df61 wsd: allow new views while unloading
Unloading duration depends on the time to save
and upload the document, during which a new view
might be opened. We now allow aborting the unloading
and resume reusing the document as-is.

Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 8f299eb2cdfe0ef869a8c90fbc602a93ba2fcb73)

Change-Id: I7bc485177929c0d1c9ef12b02672db493ac402c9
2021-09-26 17:02:01 -04:00
Andras Timar
0b1f5f6def prevent division by zero
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I9f9523336ddcbe24906787cfc3210f3471768ea8
2021-09-20 09:06:12 -04:00
Mert Tumer
b12d91de67 renamefile: Respond with reload instead
This way it will reload the document without getting
additional errors like "this is embaressing.."
and not timed out on large files due to retrying for a limited
time.

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ied341200ca21e1b7243daaf62813bc9ed69fecd3
2021-09-17 15:26:15 +03:00
Michael Meeks
930f8e2ca7 Export traces with offset timestamps to assist editing.
Change-Id: Ia9354826fb454e77ad6d2cf3714e43e6e3d06d26
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-16 09:06:16 +01:00
Ashod Nakashian
0e6a8cbfae wsd: improved dehexifying of URLs
Change-Id: Ib51e2e61432a7ac634d5b8577f75b57507b0ad60
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 90516342d154434c3a7ad3d245b00a16b8bb5716)
2021-09-13 09:40:09 -04:00
Ashod Nakashian
a7a204f16e wsd: configuration setting to control embedded-url hexifying
Change-Id: I7ed65af7341aa7dec3c9ad8d5cd503c34c355571
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 8f4316b45b1aad7a041e8b02d92e5ef10d63b2b3)
2021-09-13 09:40:09 -04:00
Ashod Nakashian
e363273e22 leaflet: support hexifying the body of the lool URI
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit cfa7972289e9c71b56c81722aedc14189f842475)

Change-Id: Iebf214a1bba76dd44fe2c160a0749675aa5b140a
2021-09-13 09:40:09 -04:00
Ashod Nakashian
6ae7864b5e wsd: hexified URL support
Change-Id: I44c46da58e0f807354aaa201ef44d3ecf50f9a07
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 6b5cbce94c41883c7f11c28f4277083798318bf7)
2021-09-13 09:40:09 -04:00
Tomaž Vajngerl
b31eb2ab92 New POST service to render a search result + unit and integ. tests
This adds a new service render-search-result, which renders an
image of the position where, the search fund a hit. The search
result contains the information in which object or paragraph,
which is just the node id and node type from the document model.

The service takes the document and the search result (xml file)
as the input and returns a PNG image as the output.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>

Change-Id: Iffc158c5b0a3c9a63f8d05830314c9bc1616b3b1
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
2021-09-13 10:36:15 +02:00
Michael Meeks
ef8d648c33 trace: turns out timestamps are micro not nano-seconds, rename API.
Change-Id: I0be1eddab3d67045e74cf89992973abf041beee4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-10 22:45:29 +01:00
Rash419
ea4d455f3a Admin Console: add wopihost name in the dashboard
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8ce68653200bb16877f6ced57fc77f6291b375a8
2021-09-09 10:13:40 +05:30
Mert Tumer
70f573f3b2 Implemented an option to pass PostMessageOrigin
External apps load loolwsd inside the iframe
and loolwsd makes postmessages to parent window.
We receive the postMessageOrigin from checkfileInfo yet
we still send some messages before we even go to the WOPI Api
in that case, if parent window runs on a different domain, we
end up with CORS blocking by the browser. To prevent that we can
allow safely passing the origin inside the first post like access_token
and sanitize it with Poco::URI::encode.

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I5724f2d103603a599d45b7f61da81fb30834ef0e
2021-09-07 10:36:07 +02:00
Pranam Lashkari
daef96dcb3 freemium: corrected typos
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: If21f4471b3ad4b20f049e2e9f2330e31989ead0b
2021-09-01 09:44:19 +02:00
Michael Meeks
d1ae5a8fb7 Valgrind support for tracing the forkit & kits.
Change-Id: Ie9dd69598bd408ae1994d8cdd6f886224890ad23
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-01 07:14:44 +01:00
Henry Castro
8d694bdf97 wsd: log warn if proof keys not found
"default installs currently don't use proof keys"

Change-Id: I43b6c5ed6633b35e58ec3e1b1cc222756a9a47d8
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-08-27 15:01:58 -04:00
Tor Lillqvist
3e0e9fbe7d Fix typo
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I6edf03cb46f80a1f88448718d9a2bba110ecaeb3
2021-08-23 09:39:24 +03:00
Thomas Koch
48f91a2aa4 use Request.has instead of .find and .end
Signed-off-by: Thomas Koch <thomas@koch.ro>
Change-Id: Ia0aa95e556186a27e3122c0cf00ca5cad80a0f3a
2021-08-12 14:38:26 +02:00
Henry Castro
57d454436b wsd: fix url redirect
Signed-off-by: Henry Castro <hcastro@collabora.com>
Change-Id: I09fda6618c35147b12f8e25204290a7d61cd766b
2021-08-06 17:21:18 +02:00
Henry Castro
9266fa5793 add option --with-feedback-location
Change-Id: I2f5b1556f0b976e9c3cb1f78383d2d05e6aef892
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-08-06 17:21:18 +02:00
Henry Castro
c8e2d25d24 add initial feedback option
Change-Id: I9357f556474e5ada881e27983c95f7527b284efc
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-08-06 17:21:18 +02:00
Ashod Nakashian
d8621b950b wsd: better response when disconnecting
Return proper HTTP code when disconnecting and log
to make the communication more effective.

Change-Id: I4da9d5a7fe4c09d6fcd44b1f31b439180d7012bd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-28 13:00:45 +02:00
Szymon Kłos
27e95bbe7e Wait for async save result on DocumentBroker stop
When async save was started but we want to stop DocumentBroker
- we shouldn't kill the socket which listens to save result.
Because when we kill socket we will destroy DocumentBroker
before saving is completed, this allows for a minimal time
to connect again to the document and receive old content
from the WOPI storage. When we wait for async save result
we will keep DocumentBroker alive and next session can be
connected and receive correct content.

fixes: https://github.com/CollaboraOnline/online/issues/2747

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I5505a5ccc1f3d6928c723bddfea16bf5c5798d1e
2021-07-28 13:00:45 +02:00
Szymon Kłos
38731d5818 Allow pasting into document even when DisableCopy is active
From our API description:
DisableCopy
Disables copying from the document in libreoffice online backend.
Pasting into the document would still be possible.

Change-Id: I1f7e272ad3b04208b534eff990fed895951b4751
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
2021-07-28 13:00:45 +02:00
Tor Lillqvist
522431a82e We generate 'S' and 'F' "Async" Trace Events in loleaflet, not 'b' and 'e'
"Async" here refers a specific kind of data in the Trace Event JSON
format, not asynchrony in general.

Actually, we don't have code that would generate such yet in
loleaflet. Just the createAsyncTraceEvent function in Socket.js. Quite
possibly the "Complete" events (a.k.a. ProfileZones) are all we need.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I611ccd4b964bcacdd1050893f70dbdb813ee3c34
2021-07-21 13:26:23 +03:00
Michael Meeks
cd56efe900 cleanup: don't assume that the web-server poll is still alive.
Since a99edb5d29 this gets a different lifecycle, and is often
joined and gone by the time we get to cleanup.

Change-Id: Ic21ca837d484a9a853c7f8f683e876406b00a943
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-07-21 10:03:13 +01:00
Pranam Lashkari
e02e1df76d Introduce Freemium options
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ib6b68ff74839cf84f2d8c8cfb7d380be9209f923
2021-07-20 14:41:18 +05:30
Ashod Nakashian
4c87cc36ff wsd: Close socket hard when necessary
Also clear its input buffer explicitly.

Change-Id: I8badbb96d98eaf10433a65fcfd13b0d6d5893594
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>

Ignore input in a somewhat gentler way.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I758302dc3bb1aa87f9fbfa726f73f4b9339e08c2
2021-07-19 17:31:55 +01:00
Ashod Nakashian
90f0360ada wsd: close the connection after failing to load
Change-Id: I571c9afba3ae2d9be83382dab571902669e8b059
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-19 17:31:55 +01:00
Ashod Nakashian
617b1aeae5 wsd: prevent recycling the listening port during tests
When running tests in parallel, closing the server listening
port before all DocBrokers are terminated runs the risk of
the listening port getting recycled by another test. This
means that the new test might get unexpected connections
from the old test that is shutting down.

This improves test stability.

Change-Id: I2c6ac9e7ed9953813e0da6ab19b960b1edc1d1a8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-18 21:14:48 -04:00
Ashod Nakashian
f63d077916 wsd: ssl certificate verification requirements
Change-Id: I72ffa586310296f1986276c3007672c41146c92b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-18 21:14:48 -04:00
Ashod Nakashian
f702c4efab wsd: support certificate verification
Change-Id: I912595f104e24dc66da9cf06bc211cb0c50c9ff0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-18 21:14:48 -04:00
Ashod Nakashian
14b694e4b8 Revert "wsd: initialize SSL if enabled or termination is enabled"
The original behavior must be preserved, which is not to
initialize SSL when termination is enabled but SSL is disabled.

This reverts commit 1c9541a6a636647086397e1310084cc990b6ed70.

Change-Id: Iba3ed3eea45b6b78e696334ca4d1a4a2c014d95b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-18 21:14:48 -04:00
Ashod Nakashian
0690f23ee4 wsd: move isLocalhost to a common area
Change-Id: I2a7986863138a254a6d74644112f5cd60bb898cd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-18 21:14:48 -04:00
Ashod Nakashian
ae7b0d9a00 wsd: before closing save a copy to upload
If the last upload had failed and we are closing,
make sure to save a new copy (i.e. save even if
unmodified) so we would have the latest version to upload.

Change-Id: I25efb76eaf9c0e05a2d18071b273447803b17cc5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-17 22:58:23 -04:00
Ashod Nakashian
61954dc67a wsd: track saving activity
This prevents auto-saving while a
save is in progress.

Change-Id: I2606df704482ad54a954414d48ed3ca35d4764a9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-17 22:58:23 -04:00
Ashod Nakashian
cc23a03dc0 wsd: correctly update the modified flag
There is an important distinction between
internally saving a document and uploading
the latest saved version to storage.

Core reports the modified state, which was
at some point used to flag the modified state
in the admin console. This state is misleading
if uploading failed.

This patch makes this distinction even more
explicit than it was. We now always update
the modified flag given by Core, and flag
the document as modified in the admin console
too.  But we only update the admin console to
unmodfied when we successfully upload and the
document is not modified at that point (which
it might very well be modified again by the
time we finish uploading).

Without this patch, we stop updating the
modified flag when uploading fails. This
is problematic when said failure occures
right before closing the document, because
the document will have no modification
but we will be stuck thinking it is modified.

This combines two commits:
8c602e179e
and
9db39ce741

Change-Id: I31c72aa2491b8e98597075cd35b6a809fab560a1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-17 22:58:23 -04:00
Ashod Nakashian
9c50fdc155 wsd: better logging of the document activity
Change-Id: I89e673ffa819600bd227fab291a46d9108ed5cca
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-17 22:58:23 -04:00
Jan Holesovsky
41c0b1add3 Sanitize the css theming.
Change-Id: Id0eb21fc7e7039bf406c074cd210c6c355bd7dbf
Signed-off-by: Andras Timar <andras.timar@collabora.com>

Sanitize the css theming.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ifccb58c2bc9a070409c9a4dd9e9e4034e7338469
2021-07-16 11:57:43 +02:00
Michael Meeks
53ac96b025 wsd: don't re-render tiles while closing a session.
During the save during shutdown we can get big invalidation
emissions, there is no point in re-rendering the view at that
stage; so skip it.

Change-Id: Ie85ef57648815a1872ca35dcb1bdfc9fa54e64c0
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-07-12 16:12:27 +01:00
Szymon Kłos
27799f23eb HTTP 302 - updates after review
Change-Id: Iaac4384385e05f33472b6678422b4a444319b59c
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
2021-07-12 08:44:39 +02:00
Szymon Kłos
fef43e237a HTTP 302 Found - block redirection loops
Change-Id: I686a801a7003d14210a0319d421b326b7f8c107a
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
2021-07-12 08:44:39 +02:00
Szymon Kłos
b72c8e9ae6 Handle all redirect HTTP verbs
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I6d8417da1e147c63bc44c3fe238bdda7e3dac1b2
2021-07-12 08:44:39 +02:00
Szymon Kłos
3330293e57 HTTP 302 Found - redirrect support for downloadDocument
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I7030159c1d745f877f927e21bea7caba25c1eb8b
2021-07-12 08:44:39 +02:00
Szymon Kłos
850f3cee71 HTTP 302 Found - remember the correct resource address
remember correct URI so all the following communication
(eg. downloading the file, upload) will be performed on new location.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Id14c5209eb1d9ffc7c24d7e02f0c7c32a60568b7
2021-07-12 08:44:39 +02:00
Szymon Kłos
f8bea2e9c5 HTTP 302 Found - redirrect support for getWOPIFileInfo
With some loadbalancers it may happen that HTTP 302 Found
response with redirect location will appear.

Change-Id: I7bac807761423adcd827cf775bd1d3d2ba87a6cc
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
2021-07-12 08:44:39 +02:00