Commit graph

4388 commits

Author SHA1 Message Date
Pranav Kant
a76825728e Pass Disable{Print,Export,Copy} options to client and handle them
Change-Id: I59a9432bbdd06d8b184f96882c5f4009fcd0be54
2016-12-13 17:59:02 +05:30
Pranav Kant
3ce8c3158a wsd: Allow disabling copy/paste to/from the document to browser
Change-Id: I73c70f46f1db11d69ebff582f72127d304689aa2
2016-12-13 17:45:16 +05:30
Pranav Kant
6affbb307c wsd: Allow hosts to disable print, export
using these WOPI protocol extensions: DisablePrint,
DisableExport, DisableCopy. All assumed to be false if not
provided.

Change-Id: I415597d710107f9d8cbb8757f361365cc2a88eb1
2016-12-13 17:45:16 +05:30
Pranav Kant
1ddd85c77c Document downloadas protocol message
Change-Id: Iad8775c441e8fbb531b4608bd6ccb391435e7dcf
2016-12-13 17:45:16 +05:30
Pranav Kant
8135e678bb loleaflet: Use readable id= argument in downloadas
Change-Id: Ica9ba833f487f2c75f8629fd91f31b216c4797b5
2016-12-13 17:45:16 +05:30
Pranav Kant
348653a73c wsd: Use EnableOwnerTermination property for ownertermination
We want document owners (sessions with their WOPI UserId =
OwnerId) close the document (for all sessions) only if
EnableOwnerTermination property is specified. Note that
EnableOwnerTermination is an extension to WOPI, and not part of
original WOPI standard.

Change-Id: I7237d172c4c54477572bc132336910250af075a3
2016-12-13 17:45:16 +05:30
Pranav Kant
3e2a9df6dd wsd: Store wopifileinfo separately per client session
Client needs to act accordingly as per permissions/settings set
by the WOPI host.

Change-Id: I7c9f311be50d4aff2562da0cfef2fff889f111d0
2016-12-13 17:45:16 +05:30
Andras Timar
0b596ae51d wsd: do not warn about missing access_token_ttl, when there is no access_token
Change-Id: I6ac7014dee21892dfd8b3b594cafe2dc030b6b2a
2016-12-13 09:56:29 +01:00
Ashod Nakashian
4bc318fb88 loolwsd: LOG_CHECK to replace assertion when logging suffices
Change-Id: I077c6394579f432c0aa9da053d20ccb9c6d31907
Reviewed-on: https://gerrit.libreoffice.org/31934
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:37:05 +00:00
Ashod Nakashian
aa1d721444 loolwsd: harden against socket errors and lock while receiving
Change-Id: I402d387272e0e30d2fe035842c50f40c3806e20d
Reviewed-on: https://gerrit.libreoffice.org/31933
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:36:27 +00:00
Ashod Nakashian
6b8ed0dac6 loolwsd: handle socket error and close better
If the socket is in error, SELECT_READ returns
immediatly as failure. In this case we sit
in a tight loop polling read over and over.
We now check for SELECT_ERROR when SElECT_READ
fails to properly close the socket and break.

When receiveFrame returns -1, we should first
check the flags for socket close, as that
is a legitimate case of returning -ve.

Change-Id: I7bbc948638a8395d28990ba92eddb9a1a9f1e6f2
Reviewed-on: https://gerrit.libreoffice.org/31932
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:35:50 +00:00
Ashod Nakashian
477ca6f414 loolwsd: cleanup the Sessions
Change-Id: I3cd065ab84e17f943fa7de7e094db574ff6fde07
Reviewed-on: https://gerrit.libreoffice.org/31931
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:35:00 +00:00
Ashod Nakashian
e60bc28a00 loolwsd: LOOLSession -> Session
Change-Id: I94369480fb0a6789375dfe5610ada300e94b80eb
Reviewed-on: https://gerrit.libreoffice.org/31930
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:34:19 +00:00
Andras Timar
708f9be23a wsd: do not log error, when access_token_ttl is not passed 2016-12-12 19:28:37 +01:00
Andras Timar
356374d96b loleaflet: typos 2016-12-12 16:20:36 +01:00
Pranav Kant
b3db321e85 Unify loleaflet's make with top level make
Top level make would now build loleaflet too if necessary.

Respect value of ENABLE_DEBUG and if present add debug-info to
generated js bundles too.

Add new rule, clean-local in loleaflet.

Change-Id: I3a9b727824f2877fc72719a8bfdeebed5448cb7d
2016-12-12 17:56:58 +05:30
Miklos Vajna
20fe9cc863 TileCache: remove redundant initializers
Change-Id: Ifb458eb1e5f60152dcebbce2ad11af2ec90e7e52
2016-12-12 12:09:35 +01:00
Andras Timar
e9a370176b wsd: fix error: declaration of ‘size’ shadows a member of 'this' [-Werror=shadow] 2016-12-12 12:08:51 +01:00
Pranav Kant
5938962e0e loleaflet: build: Skip expensive 'npm install'
This always takes ~2 seconds irrespective of whether node_modules
needs updating or not. Lets add appropriate dependencies and save
these precious 2 seconds.

Change-Id: Ided4ff334316c16521e5ea7a69d15736a1cc170f
2016-12-12 16:08:15 +05:30
Pranav Kant
94153379f5 loleaflet: Unused variable
Change-Id: Ic08a04cd196084ce82524ded67445f5b1068b83d
2016-12-12 14:58:21 +05:30
Pranav Kant
6b795ae54d loleaflet: Remove troublesome extra argument to replace()
This errors out in firefox (in some versions).

Change-Id: I4c1d77249ec6883b70c961ffe8239157a0d6466c
2016-12-12 14:55:50 +05:30
Pranav Kant
fda2f26df4 loleaflet: Don't use w2ui directly from loleaflet
Use events, 'hidebusy', 'showbusy' to interact with toolbar.
In some cases, it may happen that w2ui usage in loleaflet happens
before browser loads w2ui.js (as it is in <script> tag after the
one which loads loleaflet).

Change-Id: I9b1b249ede72ed01f97cf31fd3f93780312530bc
2016-12-12 13:49:04 +05:30
Ashod Nakashian
3ac620fc4f loolwsd: alert all users via SenderQueue
Change-Id: Ib5f4e456109a2a48f29fb6b7b75950315490c352
Reviewed-on: https://gerrit.libreoffice.org/31890
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:28:54 +00:00
Ashod Nakashian
b7205192b4 loolwsd: route client messages through SenderQueue
Change-Id: Ied0e32e8874c9754bf32f1a77c74cf8da181924a
Reviewed-on: https://gerrit.libreoffice.org/31889
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:27:13 +00:00
Ashod Nakashian
d8c8737597 loolwsd: move forwardToPeer into PrisonerSession
Change-Id: I771af0ea066d3d7cb16173861ae70dcc052122aa
Reviewed-on: https://gerrit.libreoffice.org/31888
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:25:51 +00:00
Ashod Nakashian
2065fb5972 loolwsd: set the payload size only once
Change-Id: Ieb8f6fdbdbf0fbca3aa4032aea2f15bf37e3282b
Reviewed-on: https://gerrit.libreoffice.org/31887
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:24:59 +00:00
Ashod Nakashian
da97e2ac18 loolwsd: grow the SenderThreadPool dynamically
The pool is checked for expansion before processing
items from the queue. By tracking the number of idle
thread (i.e. not currently sending data) we ensure
that there is at least one idle thread before
we invoke the socket.

If there is not enough idle threads at that point,
a new thread is spawned, so long as we're below the
limit. This guarantees that even if all the active
threads block on the socket, we'd always have one
more to process new data (until we reach the limit,
which is as many client connections as we have).

Technically, a single slow connection could
still monopolize all connections if there are
many messages to be sent to it. For that we'd
need to track and assign one thread per connection,
something we don't currently do.

Change-Id: Ic8b5e064da068b37bcfa773005495b198763c31d
Reviewed-on: https://gerrit.libreoffice.org/31886
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:24:11 +00:00
Ashod Nakashian
f8d3576556 loolwsd: Sender Thread Pool
Change-Id: I36a0ad376dad1e6b0733ebfa930baf1dd5752a8c
Reviewed-on: https://gerrit.libreoffice.org/31885
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:22:31 +00:00
Ashod Nakashian
0b42af6d8d loolwsd: move SenderQueue to wsd
Change-Id: I33af4d1b2bbf0305cbc5fa6f05266d126f1bb803
Reviewed-on: https://gerrit.libreoffice.org/31884
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:20:43 +00:00
Ashod Nakashian
233cb94eff loolwsd: SenderQueue to hold messages to send to clients
This adds SenderQueue and a wrapper of messages to
send back to clients.

Currently no threading takes place, but the messages
are pumped through the queue nonetheless.

Change-Id: Id9997539c0a2a351cbf406f649c268dd3643e88e
Reviewed-on: https://gerrit.libreoffice.org/31883
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:19:04 +00:00
Ashod Nakashian
9252477353 loolwsd: correct logging
Change-Id: I1856b68f336bc5515c1ef82b47893649510438c5
Reviewed-on: https://gerrit.libreoffice.org/31882
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 00:29:11 +00:00
Ashod Nakashian
d3c2a320ae loolwsd: refactor tile sending to offload on thread
Change-Id: I6537ca407dc64a0a78a33ba823a43e5ead570848
Reviewed-on: https://gerrit.libreoffice.org/31881
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 00:28:52 +00:00
Ashod Nakashian
9f5ec66fb5 loolwsd: prepare to offload tile sending
Change-Id: Ifafa822c05c27fc4b7ef7e0e97ae133de39ce23b
Reviewed-on: https://gerrit.libreoffice.org/31880
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 00:28:16 +00:00
Andras Timar
e73841b66c loleaflet: remove unused functions: toggleButton, disableButton 2016-12-09 16:01:40 +01:00
Pranav Kant
e845bdfbe5 loleaflet: build: Pass debug, minify variables as env. vars
Change-Id: I500b49f50901a72a93caa5cce1f50a2c2e3d0613
2016-12-09 20:08:58 +05:30
Pranav Kant
c4fe26e1db loleaflet: build: better log messages
Change-Id: I10c1cacebc542c6a1234603a264f2dbd5381c015
2016-12-09 20:06:45 +05:30
Pranav Kant
ab9d744fe5 loleaflet: Improved build process, don't build unnecessarily
No point in building things that are already built, create
different jake tasks, enclose whole of the build process in a
single jake task - 'build' which would call other various tasks
depending on whether they needs building.

Change-Id: I4b26834440ef638d697aa0793d2ced1e2c49784a
2016-12-09 18:10:55 +05:30
Pranav Kant
b940b34ab1 loleaflet-draw: Return early if no changes
Compression is most expensive in terms of time; if we detect
early that there are no changes between oldSrc and newSrc, lets
return early and skip the compression.

Change-Id: Id3d7c1d4bf89a33819907ff735e01629581627a3
2016-12-09 18:10:55 +05:30
László Németh
076e779649 loleaflet: fix footnote insertion
Ctrl-Alt-F (insert footnote) activated the Search bar (Ctrl-F), too.

Change-Id: I681156f703bc044417c9b47aad8b3ebce5f259f6
2016-12-08 23:32:26 +01:00
Michael Meeks
166c77f0d1 Make admin console easier to find in 'make run' 2016-12-08 17:47:21 +00:00
Michael Meeks
07d385630b Cleanup unit test output a little. 2016-12-08 17:47:21 +00:00
Michael Meeks
51949df882 Unit test to avoid assert returning. 2016-12-08 17:47:21 +00:00
Pranav Kant
01d91642f1 loleaflet: Use same loleaflet font for color picker
Change-Id: I4e8235a913db81f3d270a23a95e1b3144de47d08
2016-12-08 22:15:15 +05:30
Pranav Kant
33ce6f38e4 loleaflet: Check boxes against checked items in context menu
Change-Id: I1a51fec67ba79dc2e82cccb54731bfabb9731470
2016-12-08 21:58:58 +05:30
Michael Meeks
4c2e59c1f2 Don't take down WSD with an assert on a badly formed URI. 2016-12-08 14:53:01 +00:00
Michael Meeks
7cf77c26f7 Improved fuzzer - to fuzz input.
Pass --unitlib=test/.libs/unit-fuzz.so to loolwsd to enable.
2016-12-08 14:53:01 +00:00
Pranav Kant
cba45fce42 loleaflet: Improved search
Start searching as you type
Press enter to search forward
Shift + enter to search backwards
Esc to get back to editing

Change-Id: Id366069aea9eb0e96e8d73fa4b57f972b0ce78e5
2016-12-08 19:21:36 +05:30
Tor Lillqvist
e221388c79 Add an 'Idle time' column to the Admin console
Use a new protocol message, 'resetidle' to inform Admin clients
whenever a user has done anything in a document view. This is a
message that Admin clients need to subscribe to.

Also add the current idle time for each document to the 'documents'
message.

To reduce protocol chatter, the idle time is updated at most once per
10 s.

Change-Id: I418e82b05048a3628f21dcd240ccd974b3a01356
Reviewed-on: https://gerrit.libreoffice.org/31653
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-08 08:39:11 +00:00
Miklos Vajna
cb8564b17f Storage: make sure matrix is initialized before read
Change-Id: I967ab34c0f0430900b4be4424fa4493386c96c33
2016-12-08 09:33:24 +01:00
László Németh
7bf2bec78f loleaflet: better user tooltip layout in Calc and Impress
Now it is similar to Writer user tooltip coloring.

Change-Id: I68ae24145a199957c506491d38ff50472abcf1bb
2016-12-08 00:40:58 +01:00