Commit graph

5585 commits

Author SHA1 Message Date
Ashod Nakashian
175f4d995f loleaflet: no need to tell the user when doc is unloading
This is rare and should take a few short seconds
to save and then we can load as normal.

Since the client auto-reconnects anyway, no
need to tell the user to try again.

Change-Id: I51a7ad207edec3203933a1808288870e69699952
Reviewed-on: https://gerrit.libreoffice.org/36655
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-19 07:21:44 +02:00
Ashod Nakashian
9b3a22aafe wsd: save document upon server shutdown
The server correctly saves all documents
and waits to upload them before exiting.

Change-Id: I04dc9ce588bc0fa39a9deb298d0a5efa61a03f1a
Reviewed-on: https://gerrit.libreoffice.org/36654
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-19 07:04:26 +02:00
Marco Viscido
0bb650e7c4 keep expired document and query them to get the historical content
A Document has its own snapshots set.
A snapshot is a string representation of a JSON object.
AdminModel keeps also the expired document objects.
Query each document object in order to get their own history.
Admin accepts an "history" command then returns a json object.
An administrator checks the history by dashboard.

Change-Id: I73c87eff334cdb5a4a58043b2b66f18a56240b3a
Reviewed-on: https://gerrit.libreoffice.org/35926
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-04-19 04:08:38 +02:00
Henry Castro
c21221d514 loleaflet: animate pan if animate: true specified
Change-Id: I1d6b70d33d7459984da1541e3cd80e722268ce13
2017-04-18 16:39:34 -04:00
Jan Holesovsky
324499b0d9 Safer place for the tile cache cleanup.
When calling the cleanup from DocumentBroker::destroyIfLastEditor(), it might
be (theoretically) too early; so let's do it safer - as the last thing when
shutting down the DocumentBroker::pollThread().

Change-Id: Idc5e34b36d524c8f87a3a0fc99c87244e9784abf
2017-04-18 12:13:04 +02:00
Ashod Nakashian
9c14446c88 wsd: re-enable a couple more tests that are stable
Change-Id: I01bc96ce7bde7cac10d0b4d023b0d5dd774ed058
Reviewed-on: https://gerrit.libreoffice.org/36602
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:12:16 +02:00
Ashod Nakashian
6023fdc3c7 wsd: take DocBrokers lock before broadcasting diskfull
Change-Id: I4f7cccb1112c17091d1039441af4c84d5d13d059
Reviewed-on: https://gerrit.libreoffice.org/36601
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:09:22 +02:00
Ashod Nakashian
0feea0e80e wsd: include cleanup in test
Change-Id: Ie54aabc74e8980f3131a66f3610c1dcdd9f668ff
Reviewed-on: https://gerrit.libreoffice.org/36600
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:08:58 +02:00
Ashod Nakashian
651e462ef0 wsd: logs
Change-Id: I43f8e3732c6948c8214b21a506cb2e5ba56bd2ad
Reviewed-on: https://gerrit.libreoffice.org/36599
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:07:25 +02:00
Ashod Nakashian
624380089e loleaflet: don't send setclientpart when the server sets part
Client now sends setclientpart only when it wants to change
the current part number, but not when it is updating
the current part when it receives setpart from the server.

When switching parts (either by the keyboard or mouse)
LoKit sends a notification of the current part and
invalidates tiles. As a reaction to that the client
cancels its tiles and requests new tiles for the
new part. In addition, it sends setclientpart
back with the new part number.

This works fine, except when the client switches
between parts quickly (as when randomly pressing
page-up and page-down quickly in impress), by
the time LoKit receives the second request the
client would have reacted to switching the first
by sending setclientpart for the first. This
will result in a resonance back and forth ad
infinitum (or when the client goes inactive).

The client shouldn't echo back the part number
which the LoKit has told it (it should only send it
to explicitly set it itself). But the server should
be smart enough to remove duplicate setpart
notifications from the client queue. This reduces
the chances of an ocillation like that to happen.

Change-Id: Ia8a1bb25e427ab910129340ce599e3743983463b
Reviewed-on: https://gerrit.libreoffice.org/36598
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:06:02 +02:00
Ashod Nakashian
9234dc4dc2 wsd: drop duplicate setpart before sending to clients
When switching parts (either by the keyboard or mouse)
LoKit sends a notification of the current part and
invalidates tiles. As a reaction to that the client
cancels its tiles and requests new tiles for the
new part.

Since the response to setpart is a large number
of tile cancellation and new requests, the
cost of setpart is significant (esp. with large
number of clients). To avoid that, we de-duplicate
setpart entries from the client queues so there
would be only at most one setpart (the last)
queued to be sent to the client. This minimizes
the unnecessary noise when the part changes
faster than the server and/or network can
keep up.

Change-Id: I87578004203acc63d43e6d398ca04e37f766d9ba
Reviewed-on: https://gerrit.libreoffice.org/36597
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:04:22 +02:00
Ashod Nakashian
5479788e52 loleaflet: reconnect when load fails due to unloading
Retry up to 10 times with a delay of 1 second in between.

Also, show the user a message (after first reconnection
fails) that the document is unloading to try again
(but of course we auto-retry anyway).

Change-Id: I616d7643f146a6d5b7ccda7bb2aa567e3a9efe47
Reviewed-on: https://gerrit.libreoffice.org/36596
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:03:41 +02:00
Ashod Nakashian
28d15220e6 loleaflet: don't reference uninitialized docLayer
Change-Id: I0ea169474f17aa541f678c7474a6903b85129101
Reviewed-on: https://gerrit.libreoffice.org/36595
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:02:41 +02:00
Ashod Nakashian
5e3fc10eee loleaflet: log socket activity
Change-Id: I763ac09fcd5eef700b331b4d8016db3d30e1ef9a
Reviewed-on: https://gerrit.libreoffice.org/36594
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 06:50:25 +02:00
Ashod Nakashian
1262378301 wsd: send document unloading error as WS message
Without an explicit WS message, the client
does not get this message and the handler
is not invoked at all.

Change-Id: I71e210a9958965cff35dd4d0f1d99985429b82f4
Reviewed-on: https://gerrit.libreoffice.org/36593
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 06:49:23 +02:00
Katarina Behrens
8927eaf057 Strip trailing '/' from LO_PATH, if there's any
symlink() with path/with/trailing/slash/ and thus creating chroot
fails with ENOENT in totally opaque way

Change-Id: I5cd5213d8b6bfc50ea11cf8586b2a7b7f334631d
Reviewed-on: https://gerrit.libreoffice.org/36536
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2017-04-17 02:05:58 +02:00
Pranav Kant
86be5a24a5 loleaflet: Remove box-shadow from comments
This box-shadow interferes with direct comment children and breaks the
root-children comment block UI. Lets remove the shadow for now.

Change-Id: Idda659bcfca76093c148400b2ab311bc39861e84
2017-04-14 13:46:01 +05:30
Pranav Kant
3f397584aa loleaflet: Adjust parent,children when comment is added/removed
... in between comments.

Change-Id: I7b707d04adb045df43c66a29ccc9d2c3e702fca5
2017-04-14 13:45:16 +05:30
Pranav Kant
043ec94bef loleaflet: Same width for all comments, different from redline comments
Separate css classes for these different types of annotations.

Change-Id: I2013a05a2f7095956765661169670e0bb87bb372
2017-04-14 11:46:12 +05:30
Pranav Kant
3f4c678ab3 Combine root comments with their children comments
Change the layouting algorithm to check for comment relationship and set
the layout bounds accordingly.

Change-Id: I67cc32092d8cf2c1bbc0d677258387739bfc638e
2017-04-14 11:32:05 +05:30
Henry Castro
95d5941e9b loleaflet: update annotation position when performed zoom
Change-Id: I931081b2451d965ab669b428f8b258c3e39fb729
2017-04-13 20:58:52 -04:00
Andras Timar
976ce69183 loleaflet: ' Save ' -> 'Save'
Change-Id: I23b24aeda989652b04c1759810b1801b041e0a6b
2017-04-13 12:16:03 +02:00
Miklos Vajna
4269fbbaa4 wsd: remove unused using declarations in LOOLWSD
Change-Id: Id8a7f94cef0ab34fb7d789adff92b9c822af62c2
2017-04-13 10:31:24 +02:00
Ashod Nakashian
ed51fafece wsd: DocBroker is Alive if not flagged to stop
There is a race between creating and adding
a DocBroker into the DocBrokers container
and cleanupDocBrokers is invoked (on timer)
before it had a chance to start its poll
thread. This is exceedingly rare, but it
has happened.

We check that_stop==false flag when deciding
isAlive such that cleanDocBrokers will
not remove it before its thread had
a chance to run (which would happen
after adding it and creating the
ClientSession).

Also, no point in checking isAlive from
the polling thread itself (of course it is
alive).

Change-Id: If54fe2b5fce0697ee0e2f38f1662c71105e29347
Reviewed-on: https://gerrit.libreoffice.org/36500
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-13 05:54:16 +02:00
Henry Castro
1a580cc993 wsd: add mime type image/png
IE11 requires explicit content-type image/png

Change-Id: Ie0a886bc9b6af50be788456a93583176788c5315
2017-04-12 22:11:23 -04:00
Henry Castro
b0c889f2d2 loleaflet: animate the new position of selected annotation
Change-Id: I47af4ac3ec01b03797a03dfcc91ec84f0fd39bb5
2017-04-12 17:24:48 -04:00
Henry Castro
44482615ca loleaflet: update PosAnimation.js file
Change-Id: I38a2643e67d1d341b486c987eb73dc5e5608a7cb
2017-04-12 17:24:48 -04:00
Andras Timar
1aeaf41999 loleaflet: updated pot files
Change-Id: I0a589a07bb5658c7b9b749c7184fa09c2e1a49de
2017-04-12 22:35:09 +02:00
Andras Timar
baa07c0997 loleaflet: src/control/Control.ContextMenu.js contains translatable strings
Change-Id: I4010eb296a1771f0e8fbfa5078b4847193cfc188
Reviewed-on: https://gerrit.libreoffice.org/36491
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2017-04-12 22:26:43 +02:00
Jan Holesovsky
ba3b32aad1 Clean the cache even when the document was not modified.
And rename the option, to match better the existing tile cache setting.

Change-Id: Iea5c2c5628a403dd2dc3e2943cd858f40e2a2ebc
2017-04-12 20:04:30 +02:00
Marco Cecchetti
c651a69485 wsd - implemented an option to clean cache on doc close
Change-Id: I0bdb373efb93546527a168df2ed1c75539e95fe4
2017-04-12 19:00:25 +02:00
Jan Holesovsky
7b7c73f8be Align the Accept / Reject buttons with the kebab menu.
And few other improvemnts inluding:

* use svg instead of png for the menu
* add title (caption) for the Accept / Reject change.

Change-Id: Ic7e781d7e93d319f766b387a8eddfa70c1920760
2017-04-12 17:43:49 +02:00
Pranav Kant
699e8df9a7 Use CSP without WOPI host too
Fallback from b7eafb1e4a

Change-Id: I741a3f2320cfeec2250c10913871cf350861a39d
2017-04-12 19:58:19 +05:30
Pranav Kant
b7eafb1e4a Move CSP to response headers from meta tag in html
Some older browsers don't have meta tag support for CSP. Lets put all of
the CSP in response headers to be compatible with oldies.

Change-Id: I7f0d7c294e492b3c69ebea6fbd820d6558b9c3b3
2017-04-12 19:24:51 +05:30
Jan Holesovsky
f5a69785de _initialCenter is now unused.
Change-Id: Ie9442168bc6075574b6d83bf0558b0c4983b2361
2017-04-12 14:39:15 +02:00
Pranav Kant
336ac4d6d1 loleaflet: Grid/selection/caret is sometimes displaced
This is actually not a displaced cursor, but displaced tiles map pane.
It happens when the user refreshes the the document page and
before the document finishes loading, switches to some other tab and
then get back to the document when the document load finishes. In such
circumstances, due to browsers not emitting the 'resize' event (probably
because it didn't have the focus when the map loaded) we return
incorrect/unexpected map center. Because 'resize' event sets this._initialCenter to
null, so map.getCenter() never returns this._initialCenter and instead
return this.layerPointToLatLng(this._getCenterLayerPoint()) which seems
to be the correct thing to return here.

The reason that the displaced cursor is not
observed when user doesn't switch to other tabs is because of the
browsers emitting the 'resize' event before we set the map transforms.
Nevertheless, in some circumstances it is quite possible that this
event, 'resize', is processed after we set the transforms even though
user hasn't switched the tabs but probability of this is very less which
justifies this bug's hard-to-reproduce nature when user doesn't change
the tabs.

Instead of making sure that 'resize' event is triggered before we set
the transforms, removing this block of code that returns unexpected
return value (which we never seem to use anywhere anyhow) seems more
sensible thing to do.

Change-Id: Iff532a902e6100be7f39c204cbf2f28f1a7f6a49
Reviewed-on: https://gerrit.libreoffice.org/36458
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-04-12 13:53:58 +02:00
Miklos Vajna
4dbdd72bc2 wsd: avoid std::string::compare() in FileServer
When we are just interested in equality. compare() is more meant for
sorting functions where negative/zero/positive return value is useful.

Change-Id: I11138a14dc08e23d33f3848aeb734d9f56f3e9f7
2017-04-12 13:46:09 +02:00
Ashod Nakashian
1752dd74d6 wsd: avoid miscounting outstanding child forks
The number of outstanding child forks can
become negative if more children are
spawned than requested.

This prevents such a scenario from
permanently preventing WSD from spawning
new children, which happens when
OutstandingForks is negative.

Change-Id: Ief1e56d7b4a079e097ca2d18bd90a01d935f6b30
Reviewed-on: https://gerrit.libreoffice.org/36437
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-12 06:11:05 +02:00
Henry Castro
75e06f7687 loleaflet: fix position when adding new annotation
Change-Id: I267df778715cb9f60c1b62c52ed405fd78ade8f9
2017-04-11 20:39:40 -04:00
Miklos Vajna
08989a12ac wsd: avoid use-after-free in ClientSession
Commit 1e1f23716c fixed this already by
introducing by-value parameters, but
8a1f321c84 broke it. Fix this again, this
time more explicitly.

Change-Id: If29250ac2e99855796935b5cc05ccb222f8a4ad5
Reviewed-on: https://gerrit.libreoffice.org/36436
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-04-11 23:20:08 +02:00
Miklos Vajna
8a1f321c84 DocumentBroker: avoid unnecessary copying
Change-Id: Iaa555ed8e347d0e1712c617839f007d0b4f3204b
2017-04-11 08:54:28 +02:00
Henry Castro
7521e9bb91 loleaflet: add line between the currently selected comment ...
and the associated selection

Change-Id: I58d548f78e9d6594336abed8e77993d2fafe867e
2017-04-10 21:43:42 -04:00
Henry Castro
4db4ecd680 loleaflet: save comment if exists changes
Change-Id: Ided5cc2f60ae14863e6462e400735e291f1b54a5
2017-04-10 20:52:41 -04:00
Pranav Kant
4d6b338bf0 security: Stricter Referrer-Policy: no-referrer
I don't think we should leak our address
(which mostly is behind a WOPI host and end-user
has no idea of what host LibreOffice Online is running at) in the
Referer header. Lets be more strict here and don't leak our address
at all.

Change-Id: Ibc30e9b64e2e06e2e8d541c5f089320ecb11412b
2017-04-11 00:02:00 +05:30
Jan Holesovsky
e0f7c3fc67 Set the _owner even in the release builds.
We are warning about thread affinity even in the non-debug builds.

Change-Id: Ia91170765e9f4a29939dee847899345e9396d2c3
2017-04-10 14:55:04 +02:00
Pranav Kant
1437a060ec security: Implement HTTP Public key pinning
Though this guard the user against MITM attacks, but enabling this also
has the potential to brick your websites. So, do not use it/enable it
without understanding what it actually is.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning

Though this should work, but I have not been able to test it because of
Firefox and Chrome's limitation/feature that key validation is not done
when certificate chain terminates at a user-defined trust anchor and I
couldn't find any way to temporarily enable the HPKP key validation for
such CA chains.

Change-Id: I64d4ff82b04c59642fa7b8bac2f8788a03950b28
Reviewed-on: https://gerrit.libreoffice.org/36357
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-04-10 14:46:24 +02:00
Pranav Kant
74020e0f1f Revert "wsd: Fileserver cleanup"
This reverts commit de2bc17c04af088d9c7e18a97216b174494e1a9c.

Lets not introduce any cleanup commits while we are near a release, will
apply it again after the release. The cleanup is supposed to not handle
the custom file server root correctly, so don't forget to test it with
a custom file server root before re-reverting.

It changes the path where loleaflet.html is searched for from
/usr/share/loolwsd/loleaflet/... to /usr/share/loleaflet/...
and doesn't find it there.

Change-Id: I23940e9a3e06721f0a8b7493a526f42d2072cfa4
2017-04-10 15:26:05 +05:30
Pranav Kant
a0d7c33877 security: X-Frame-Options: Deny framing if no wopi host
Change-Id: I6936f8a11e3e076e111e0883305f47064e032983
2017-04-10 15:26:00 +05:30
Miklos Vajna
8958e1c767 wsd: make requestURI a const reference
It's copy-constructed from a const reference but is only used as const
reference.

Change-Id: I9a58561616bcfeff0c45803f3244f8e78d54731a
2017-04-10 10:44:14 +02:00
Ashod Nakashian
55180606f8 loleaflet: reconnect transparently the first time
Don't show the "This is embarrassing" popup before
first trying to reconnect at least once.

In most cases reconnection is successful transparently.

However, if necessary, we could add some delay to
reconnecting to give the server time to recover,
but without good reason for this complication it's
unwarranted. Server-recycling reconnections have
such a delay.

Change-Id: Ic8e32c451429a24f8362431672057145a492a23f
Reviewed-on: https://gerrit.libreoffice.org/36328
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-10 06:12:22 +02:00