Commit graph

865 commits

Author SHA1 Message Date
Tamás Zolnai
8d92b0809d Store wiredIDs on the server side
So we can use this information in tile requests.

Change-Id: I87ba420ec0fd699353d48a228268e546ace21921
2018-07-19 14:13:03 +02:00
Tamás Zolnai
e1b22eaac3 Calculate TilesOnFly limit based on visible area
Use 10 as a minimum value.

Change-Id: I9442a427fd25e1a7a32c3d1d06aa34d2c4ca2472
2018-07-19 14:12:52 +02:00
Tamás Zolnai
2fda5f7d92 Use an upper limit for number of tiles we push to the network
I used number 25 as this limit. It's an approximate value. It's enough
to handle the first 5-10 character input without waiting for tileprocessed
messages. After the first 5-10 characters the tileprocessed messages are
arriving continuously (same frequency as the typing speed), so for the later
character inputs we always have some tileprocessed messages arrived so
we can push new tiles to the network again.
This 25 upper limit also seems enough to send all tiles when a whole page is
requested (e.g. zoom os scroll).

We store the requested tiles in a list, used as a queue. I don't use std::queue
because sometimes we need to do deduplication (replace older versions of the
same tile with a newer version).

Change-Id: I22ff3e35c8ded6001c7fc160abdc1f1b12ce3bae
2018-07-19 14:12:41 +02:00
Tamás Zolnai
4e2b50dc0f Check whether tile rendering request was already sent
Change-Id: Iceb559106dcd95d6ff7db67df76cdfb04f9fb7e0
2018-07-19 14:12:27 +02:00
Tamás Zolnai
6c4e4440e8 Handle part number a bit more robust in case of Writer
Change-Id: I7390f1c5f4289be67deacf3540068c040b230584
2018-07-19 14:12:15 +02:00
Tamás Zolnai
7428c46efe In Impress setpart message's syntax is a bit different.
Two alternative sytnax:
"setpart part=1"
"setpart 1"

Change-Id: I42683ca46d642d56cfc3dcc52a10d69a3f00462b
2018-07-19 14:12:02 +02:00
Tamás Zolnai
29df46219c Need to extract the initial part id from status message
Change-Id: Ia0651d93fedb71d3ca1e24d0356ac179e95e907e
2018-07-19 14:11:36 +02:00
Tamás Zolnai
85f96bc281 Store sent tiles's id instead of using a simple counter
Change-Id: I8cbf84923a53fb6b294bd4039eb7382326f8c445
2018-07-19 14:11:18 +02:00
Tamás Zolnai
464dd72e1c We might need to rerequest tile rendering when we are at sending them
Change-Id: I0551e51c5f5023931dad13435b4ac3517fc48931
2018-07-19 14:11:02 +02:00
Tamás Zolnai
a9c5ea9022 Add a timeout for tileprocessed message handling
For debug purposes.

Change-Id: Icc9dfc05b18f9da96b29b7cadeb57f7218832295
2018-07-19 14:10:22 +02:00
Tamás Zolnai
15afe2c0fb Wait tileprocessed message from client to send new bunch of tiles
We always  one bunch of tiles (e.g. all tiles invalidated) and we
are waiting until client send tileprocessed message back for all
tiles before sending the new tiles.
By canceltiles message we drop every previously requested tiles and
make wsd ready to send new tiles, which will be requested by the client
in theory.

Change-Id: I9901420ada549e962ffaf5e6bd58e52b86bd129d
2018-07-19 14:10:08 +02:00
Tamás Zolnai
57cdd68fcf Request new tiles in wsd by invalidateTiles message
And don't wait for the client to send back a tilecombine
request.

Change-Id: I9ea5de0f6b12dfaaf61992d34735d5b78ea382ed
2018-07-19 14:09:49 +02:00
Tamás Zolnai
161695eb66 Store client's visible are information in wsd
Change-Id: Iec3c146181b7db2e76247d5775076e6ac90eed2c
2018-07-19 14:09:33 +02:00
Pranav Kant
6f8b15dfa8 wsd: missing include
Change-Id: I561db86b4b46f1cff0d9f0c744c556d9ec74291f
2018-07-16 10:34:24 +05:30
Tor Lillqvist
3a9e536dfa When asked to convert to PNG, look for an embedded ODF thumbnail first
Change-Id: Ib777572fe5f79b1cfdd95ec3a7f84484a13ae145
2018-07-12 19:27:54 +03:00
Tor Lillqvist
405b66c8db Add a cache of "thumbnails" (PNG images) generated using the convert-to API
When asked to "convert" a document to a PNG image, i.e. what one can
call a thumbnail, check if we have a cached PNG for the same docuemnt
already, and in that case return it.

When we have done such a convert-to operation to PNG, save the result
in the cache for later re-use.

This change adds no thumbnail cache cleanup mechanism. That will have
to be implemented separately using a cron job or whatever.

There are further improvement possibilities: For instance, if the
document is of a type that contains an embedded thumbnail (like ODF),
just extract and return that. For ODF that embedded thumbnail even
already is in PNG format.

Change-Id: I882efe97acc1d81041dc7a4ccb222995940e4836
Reviewed-on: https://gerrit.libreoffice.org/57345
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2018-07-12 18:27:23 +02:00
Tor Lillqvist
3b4269a301 Use Util::symbolicErrno()
I think the general policy should be to always log errno using both
Util::symbolicErrno() and std::strerror(), never log a naked errno.
But only in cases where we know that it is highly likely that it is
the most recent system call that has failed, so errno makes sense.

Change-Id: I4a1fb31e375ea949e7da17687464361efe7c1761
2018-07-11 13:05:22 +03:00
Tor Lillqvist
1c09d4a607 Improve logging a bit
Log all error: cases in ClientSession::handleKitToClientMessage(), not
just the case of cmd=load with kind= some password failure.

Change-Id: I53c959068f5642ae41157e8feb14fd34fc59dc9a
2018-07-11 12:33:42 +03:00
Tor Lillqvist
32036fcadf We can pass a std::string directly to LOG_ERR()
Change-Id: I10027e680ad009eb04e44913323ca91c61821b87
2018-07-10 23:14:51 +03:00
Miklos Vajna
8ad281e12f wsd: avoid unnecessary value parameter 2018-07-09 09:11:20 +02:00
Jérémie Lesage
238b754f2b add docKey in documents response 2018-06-29 18:10:25 +01:00
Jérémie Lesage
f084ea53f6 Ensure all sessions have a sessionId and are subscribed.
Simplify constructors, and factor out subscription code.

Change-Id: I4f3ed1eb06abec193d6db1f7c78815ffe1e1b5aa
2018-06-29 18:10:03 +01:00
Pranav Kant
8156c2a8f1 wsd: in case of multiple query param, handle &attachment= correctly
In case of integration with OC/NC, we have WOPISrc= as query param used
for load balancing. So, the earlier approach failed with integration.

Change-Id: Ib73f4f18eaec870dd53b67886b1b6016416a2e78
Reviewed-on: https://gerrit.libreoffice.org/56531
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2018-06-28 18:45:57 +02:00
Michael Meeks
a521527777 Fix logging a little.
Change-Id: I858ffb40e071eae3907eeff9c2d6291fd805dc02
2018-06-15 17:38:12 +01:00
Jan Holesovsky
b65894b287 Avoid crash in the non-wopi case.
Change-Id: I87aff462dab4abca0235622493f720eacbc39f03
Reviewed-on: https://gerrit.libreoffice.org/53448
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-06-14 17:01:02 +02:00
Ashod Nakashian
b3bdd5786d wsd: support optional forcing tracking changes at load
Since changing the tracking state is done by toggling,
we need to wait to get the current state at load time
before we can tell whether we need to toggle it or not.

Change-Id: Ib5a2639b2acf3874c191971eedf9a3bebcefebad
Reviewed-on: https://gerrit.libreoffice.org/53415
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-06-14 17:00:39 +02:00
Ashod Nakashian
d3d4812583 wsd: localize variables
Change-Id: I411e435fa2360423b4c48d087eb501b942cc637d
Reviewed-on: https://gerrit.libreoffice.org/52419
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-06-14 16:52:49 +02:00
Ashod Nakashian
fbc8681406 wsd: refactor diskpace and session limit checks
Checks are now done after adding new sessions
to DocBroker rather than before, so the current
session being added doesn't need special handling.

The checks for diskspace is separated from that
of the number of sessions as they are unrelated.

Also, no reason to do the checks for convert-to
requests, since these don't have interactive
clients, rather the connections are closed after
the conversion.

Change-Id: Idc50cd38263e6779acdeed72d5eb876a3228c96e
Reviewed-on: https://gerrit.libreoffice.org/52418
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-06-14 16:08:47 +02:00
Ashod Nakashian
93b41638a5 wsd: reduce indentation
Change-Id: Id8cda0980d332eb751fbb2708b9075296bf15a0b
Reviewed-on: https://gerrit.libreoffice.org/52417
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-06-11 22:17:49 +02:00
Ashod Nakashian
18750d2d39 wsd: warn for invalid file requests by clients instead of error
Also, logs append new-line automatically.

Change-Id: Ie5b09e454236cab2cdaa14d6f8be7b67e8fb1000
Reviewed-on: https://gerrit.libreoffice.org/52416
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-06-11 22:17:04 +02:00
Jan Holesovsky
ce5fefcb5d Need a way to test the branding even in the debug mode.
Change-Id: Ia1d082a05393b298cd009a256b1a708e924097b9
Reviewed-on: https://gerrit.libreoffice.org/55290
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-06-04 20:15:23 +02:00
Pranav Kant
2e21cf5dcd loleaflet: Open pdf file in new tab instead of asking to download
new parameter to download POST requests, ?attachment=0 to instruct wsd
to not set the Content-Disposition header.

Change-Id: Id7694d940e1b4d616263ad720d29f1474164eb68
Reviewed-on: https://gerrit.libreoffice.org/54918
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-05-30 15:14:01 +02:00
Andras Timar
14bda5897e more tweaks to supported/unsupported branding
Change-Id: I6df2047ace23a2613bb1a314284c8aa2cc2a5c8d
Reviewed-on: https://gerrit.libreoffice.org/54759
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-05-24 15:35:23 -04:00
Jan Holesovsky
49b3957086 Throw if admin console is not enabled.
And few other smaller tweaks around different branding with support key
enabled.

Change-Id: I9a751374c9384d9535a208c9bd912e2041fd5879
Reviewed-on: https://gerrit.libreoffice.org/54753
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-05-24 15:22:07 -04:00
Henry Castro
6ff069db62 respond different logo brands when it has support
Change-Id: Icddc8b67a20fd829c90c3c5d8eb6942da9c5e74d
Reviewed-on: https://gerrit.libreoffice.org/53583
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-05-24 15:10:45 -04:00
Michael Meeks
7475120c81 If a monitor is dis-connected, try to re-connect it.
Change-Id: I04f254acfe823f07e7fb11b277e661c09e146ebd
2018-05-18 17:35:19 +01:00
Jan Holesovsky
432a1c7d78 Split close(bool) into close() and terminate().
The bool flag was causing 2 complete separate code paths anyway.

Also remove stop(), calling stop() followed by close() made no
difference.

Change-Id: Ica4c887b0324390d4e006a26eb4119bd5ab08723
2018-05-18 15:16:40 +02:00
Jan Holesovsky
088acf5e98 Before we kill the child, check it exists, ie. kill(pid, 0) == 0.
Also warn when anything was left out.

Without this, we leave abandoned children around.

Change-Id: I293a530ffceeb7f6bdc0cc775335c782945de6e7
2018-05-18 15:16:40 +02:00
Jan Holesovsky
93cc4b4548 Use std::shared_ptr consistently.
Change-Id: I6bf3ff7de47010fd78fab26a5a318bde21c1f153
2018-05-18 15:16:40 +02:00
Jan Holesovsky
6996139e5f Use correct path in the client websockets.
Change-Id: Ie0bf6646ff3f6e6cf99b505143a416c86a3a33b8
2018-05-18 15:16:40 +02:00
Jan Holesovsky
98ed24257b Move the functionality from connectToMonitor() to SocketPoll.
Change-Id: Iab2ac09638323f5e59f7a2ea0d880f52989ad64d
2018-05-18 15:16:40 +02:00
Michael Meeks
9e7dff79f3 re-factor socket factories to take a client parameter.
Change-Id: I0be98eb583b4f8081dd8ad23e688e93c55220367
2018-05-18 15:16:39 +02:00
Michael Meeks
80a13a1e7b More work on client / Monitor websocket connections.
Change-Id: Ic70fe522e24f2b1863c2d9d1dd6941785510758a
2018-05-18 15:16:39 +02:00
Michael Meeks
b483f477dd Allow a 'monitor' to be connected to remotely if configured.
So far monitors have the access an permissions of an
authenticated admin.

Change-Id: I59dfa8a646a60584a5c113ee0521e9afba4f6b76
2018-05-18 15:16:39 +02:00
Andras Timar
d66e8d13b7 serve files with old gith hash in their path, that comes from cached discovery.xml
moreover:
* noCache is always true in debug mode
* when noCache is true we return an explicit "Cache-Control: no-cache" line

Change-Id: I157a410df0a90f9ab151b899e44566b95cbd9929
Reviewed-on: https://gerrit.libreoffice.org/54517
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-05-18 14:17:23 +02:00
Safir Depo
f6c7df1d0d bugfix for commit:910ae80-'wsd: to filter clientAddress before POST action.'
Change-Id: I48e6d89fc62c6a656d9e8a74f9f5f8be1d687940
Reviewed-on: https://gerrit.libreoffice.org/54325
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-05-18 13:01:03 +02:00
Michael Meeks
bb49e17e8f Start the admin thread even if it is disabled.
The admin thread does memory cleanup as well which is required.
This also reduces logging churn.

Change-Id: I1c6cfaf6085b685f230dc24ae1716b0256d892f8
2018-05-15 10:58:02 +01:00
Michael Meeks
41238c5d1a Restrict convert-to to known hosts - not all insert / downloads.
Change-Id: Ief26c80bf7e9e96f3c5dce0d8739a825f6fac629
2018-05-14 12:03:17 +01:00
Jan Holesovsky
88eefe75c5 Improve readability of the admin console password check.
Also disable PAM by default.

Change-Id: Id1197f0d049ce56f698952b87d2c4760412eb8ec
Reviewed-on: https://gerrit.libreoffice.org/53727
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-05-02 16:34:57 +02:00
Andras Timar
0f59930e7f do not allow empty admin console user or password
Change-Id: I3dfb74f62c53d8c7ab80094d4831203d065f0b4c
Reviewed-on: https://gerrit.libreoffice.org/53673
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-05-01 21:46:07 +02:00