Commit graph

5939 commits

Author SHA1 Message Date
Jan Holesovsky
0033607f01 loleaflet: Many of the WOPI impls. do not provide avatars yet.
Change-Id: If72a6be9102cb96fe1a6b31f85c0e47bb0622558
2017-06-01 22:07:08 +02:00
Pranav Kant
a0710c9613 Inform the current session about document change too
Change-Id: I9947eb8b23e5a698cc2cbf39bfde4e1941aae0f0
2017-06-01 22:07:25 +05:30
Pranav Kant
f4b22bbb3c Broadcast command result back to clients
This is required to tell the clients if the command they issued was
successfull or not. In this case 'savetostorage' is the command that we
are interested in knowing the success status of.

With this, now if the user commands to overwrite the document, dialog
boxes of all other users are automatically closed.

Can easily more commands in future for this kind of thing. Its similar
to unocommandresult, except its not a uno command, but our internal
command.

Change-Id: I2e7e1fd5edbd55c13ee4bf9bce24284483d6507f
2017-06-01 21:42:29 +05:30
Pranav Kant
dce714efb8 Toggle this flag after a successfull save
Change-Id: Id1bf5bc5e32e24f68094f3020f4a7c4c4117f18a
2017-06-01 21:07:52 +05:30
Pranav Kant
9f535580a6 Close the dialog before showing a confirmation dialog
Change-Id: If7220c37f8456627181500d7428caf3657816a16
2017-06-01 21:07:21 +05:30
Pranav Kant
41234773e3 If user permits, save to storage force-fully in case of doc conflict
There is one known problem still - after any user decides to overwrite
the file to storage, other users are not informed, so their dialog keeps
hanging on the screen until they press the cancel or reload button.

Change-Id: I6dad1585e4c53eeed79cd38316892a7f239d44ef
2017-06-01 19:53:10 +05:30
Pranav Kant
4d61cae4c8 If user commands, refresh the document for all in case of doc conflict
Change-Id: I42c61fb8099b0bcc60f942e602561cc97486a918
2017-06-01 19:46:38 +05:30
Pranav Kant
d6ef241cf5 Don't be so rude
If we are rude, then we don't tell the reason behind closing the
document to our clients.

This method earlier was used to do 'ownertermination', but without this
patch, ownertermination is not going to work. We regressed somewhere in
the past.

Change-Id: I7a2513e567f72b1adf00d5a74b118e116d6d99d3
2017-06-01 18:17:39 +05:30
Pranav Kant
ba4e75cfae Inform all clients when document changed behind our back
Introduce a new header X-LOOL-WOPI-Timestamp

This is a WOPI header extension to detect any external document change. For
example, when the file that is already opened by LOOL is changed
in storage.

The WOPI host sends LastModifiedTime field (in WOPI specs) as part
of the CheckFileInfo response. It also expects wsd to send the
same timestamp in X-LOOL-WOPI-Timestamp header during WOPI::PutFile. If
this header is present, then WOPI host checks, before saving the
document, if the timestamp in the header is equal to the timestamp of
the file in its storage. Only upon meeting this condition, it saves the
file back to storage, otherwise it informs us about some change
to the document.

We are supposed to inform the user accordingly. If user is okay
with over-writing the document, then we can omit sending
X-LOOL-WOPI-Timestamp header, in which case, no check as mentioned above
would be performed while saving the file and document will be
overwritten.

Also, use a separate list of LOOL status codes to denote such a change.
It would be wrong to use HTTP_CONFLICT status code for denoting doc
changed in storage scenario. WOPI specs reserves that for WOPI locks
which are not yet implemented. Better to use a separate LOOL specific
status codes synced across WOPI hosts and us to denote scenario that we
expect and are not covered in WOPI specs.

Change-Id: I61539dfae672bc104b8008f030f96e90f9ff48a5
2017-06-01 16:17:07 +05:30
Pranav Kant
15a4474572 Remove superfluous WOPI calls to getFileInfo to check timestamp
One can add the timetamp information in the PutFile call itself. This
way we can avoid making an extra CheckFileInfo call here.

Change-Id: Iae180262e648c36b9cfeb6d5fabdf5d243b93afb
2017-06-01 16:17:07 +05:30
Pranav Kant
cf968e6768 Factor out iso8601 to Poco::Timestamp parsing
Change-Id: I627a7b6b72899371e880e461685f99a86a858232
2017-06-01 16:17:07 +05:30
Ashod Nakashian
935abfacd9 loleaflet: user avatar-specific css for the user list
Change-Id: I5540c3267efcb23513d7df25427af8a8ff0d8909
Reviewed-on: https://gerrit.libreoffice.org/38293
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-06-01 12:40:53 +02:00
Ashod Nakashian
402c2ce2ad loleaflet: show avatar in comments
Change-Id: I97a781a2faf626c2ac6f4b178127aaa77c7775d0
Reviewed-on: https://gerrit.libreoffice.org/38292
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-06-01 12:39:33 +02:00
Ashod Nakashian
a59f78b656 wsd: UserExtraInfo is a map, not array
Change-Id: I64ef04c96223ee74099697cb2276307d834db329
Reviewed-on: https://gerrit.libreoffice.org/38291
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-01 07:48:15 +02:00
Pranav Kant
073b58269b tdf#103673 - Use hex color value in API
Change-Id: I51e2431e9253a625fb590af276d991a34e720141
2017-05-31 14:20:58 +05:30
Pranav Kant
d840e8720a Handle WOPI PutFile unauthorized access token
Change-Id: I29ee8cc0c9f3ea42f70628eca6f74d161d1a38f9
2017-05-31 12:08:31 +05:30
Pranav Kant
ac8e458bda User save should terminate edit in calc; and save if unmodified
Only autosave should do the opposite which it already does in
DocumentBroker.

Change-Id: Ibb86e0b29fc058318de96d2684c326dbe958e6fb
2017-05-31 11:27:14 +05:30
Henry Castro
d31e0e3aac wsd: test: undo conflict
Change-Id: Iafdcf3e206a425b7e55cca7818beb620e9d06f85
2017-05-30 22:26:05 -04:00
Henry Castro
143afd674a loleaflet: merge comments and redlines items
Comments and Redlines were mutually exclusive, but a document
can contain both.

Change-Id: Idb13f0c0e1216edc6bed3291c0c486b45ad74b56
2017-05-30 15:59:00 -04:00
Andras Timar
87b009c59c --enable-silent-rules for package building
Change-Id: I81ad7624b447b6c5f60e1f6e37e2b93896abe792
2017-05-30 13:34:39 +02:00
Andras Timar
cbafebc58a package loolconfig to rpm
Change-Id: I04b8204fde23bd3c674ec622c959ff5ab7714d98
Reviewed-on: https://gerrit.libreoffice.org/38152
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2017-05-30 11:55:28 +02:00
Ashod Nakashian
8a2c60e5b6 wsd: avoid race during viewinfo notification
Change-Id: If2d8adc67337a5529cb6898808a84727ff1df38e
Reviewed-on: https://gerrit.libreoffice.org/38123
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:47:42 +02:00
Ashod Nakashian
d76ce9169c loleaflet: suppress docunloading error
This is a soft-error and reconnection
is done transparently, so no need to
show the user unhelpful message.

Change-Id: Ie240897fec1ecdc29a9fc1c1482a416a89ca5323
Reviewed-on: https://gerrit.libreoffice.org/38122
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:46:42 +02:00
Ashod Nakashian
d0ac8a4b96 loleaflet: add user avatar to useritem
Change-Id: I0b366ab4b92fb9b1d5f7aa0ea6fe51ac9897bdce
Reviewed-on: https://gerrit.libreoffice.org/38121
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:45:58 +02:00
Ashod Nakashian
da2d3cbc92 wsd: support per-user links and commands
userextrainfo is a json array that contains
extra user-specific links.

Currently 'avatar' is assumed to hold the
image url for the user's avatar.

'mail' and other links can also be added.

Change-Id: I37c4c68bfa0b7ee659e017b4867dcb8cf5c2ca2f
Reviewed-on: https://gerrit.libreoffice.org/38120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:45:18 +02:00
Aditya Dewan
66a3e1c273 tdf#106449 Admin console: adding user list
Change-Id: I41b15c6a73fa61c21ef5ab79de149b445014c99a
Reviewed-on: https://gerrit.libreoffice.org/38017
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-05-27 07:08:25 +02:00
Michael Meeks
c224413a9d Track bytes recv'd and sent on StreamSockets.
Dump on USR1 as part of our state.

Change-Id: I4c6b87c19bca768402c9b0b8e26f16336e007749
2017-05-26 15:54:58 +01:00
Jan Holesovsky
82704ed777 loleaflet: Let's not use a 'disableabout' param.
Instead, just disable the Help -> About choice if the 'about-dialog' div was
removed from loleaflet.html.

Change-Id: I997aa5489bcfbd02f56feb79bea14e92d3666bf2
2017-05-26 10:18:05 +02:00
Jan Holesovsky
9aecf428f6 Revert "wsd: enable option to remove About dialog elements"
The request was meant the other way around; let's just not present "About" in
the menu when there is no element with "about-dialog" id.

This reverts commit b9305d17ce.
2017-05-26 10:03:33 +02:00
Henry Castro
b9305d17ce wsd: enable option to remove About dialog elements
Change-Id: I33c351cbc7373255a22f44cb31e53f21a00869bf
2017-05-25 17:43:11 -04:00
Marco Cecchetti
1588d2fe12 loleflet - sc: header incorrectly shows selection sometimes
Problem:
- Select a whole row, let's say row 10.
- Select a whole column, let's say column I.

=> Columns headers right from I, (J, K etc.) are still highlighted.
Similarly if a column selected first, and a row next.

Change-Id: I13ad0e2a152ddbf96c4889a3aea5129885bc95b5
Reviewed-on: https://gerrit.libreoffice.org/38000
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-05-25 11:09:59 +02:00
Marco Cecchetti
061c720ee1 loleaflet: calc: styles are visible in fonts dropdown
Change-Id: Ia909ed9f35d6a1c80f6696abeddefe2d4ad2d6a0
Reviewed-on: https://gerrit.libreoffice.org/38001
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-05-25 11:05:21 +02:00
Pranav Kant
1a1ab5fd57 wsd: Only disable copying when DisableCopy is mentioned
Earlier, DisableCopy was a misnomer disabling both copy and paste. Now
it only disables copy from the document but allows pasting into the
document.

Change-Id: I8ddfdd493918331276f0656468d3b94c4283fa4d
2017-05-25 14:11:33 +05:30
Pranav Kant
7a4bc5b95a admin-console: Check the password against hashed value in config
The new password hash property is called secure_password in the config
file. `loolconfig` tool should be used to set the password hash in
appropriate format with desired salt length, password length, number of
iterations in PBKDF2.

To be backward compatible, plain-text password for admin-console in
config file is still accepted in case secure_password property is
missing from the config file.

Change-Id: If229999dac62856e368555c0242c4aa6f8061fba
2017-05-25 01:18:31 +05:30
Pranav Kant
9bd89e89c3 loolconfig: tool to generate admin password hash with PBKDF2
A normal usage to set the admin password would be like :

loolconfig set-admin-password --config-file ./loolwsd.xml

Other command line options can also be given, like --pwd-salt-length,
--pwd-hash-length, --pwd-iterations.

Change-Id: I2a6f8d25e068b53a3f945426f0779c8410b2c8ba
2017-05-25 01:18:31 +05:30
Henry Castro
c6b1d29578 loleaflet: simplify disable about dialog
CreateMenu is a recursive function

Change-Id: Ied1b076c1ff04a1d471af2360aa8f9fbbe3289ff
2017-05-24 15:25:36 -04:00
Henry Castro
5d22b274f8 loleaflet: add parameter to disable 'About' menu
Change-Id: I07fa655b8318f78d7e479a3dc34830ebe5f81a2e
2017-05-24 10:28:14 -04:00
Henry Castro
05deed08b4 loleaflet: fix undo repair document popup
UNDO_CONFLICT was intented to notify views, but
the constant value changed with latest patch upstream

Change-Id: I09062725539df3d974a47d89374d822d1d852770
2017-05-23 16:42:49 -04:00
Aditya Dewan
9db39ce741 tdf#107752 admin console: indicating whether a document is modified.
Change-Id: I6055a601c1dd3b5e9700ef75d7c07d7e0b13d663
2017-05-23 19:00:53 +05:30
Pranav Kant
c05aec945d Revert "wsd: Use hostname and port in doc key too"
This reverts commit e8ff268992.

To have support for both multitenancy - several WOPI hosts using same wsd -
and WOPI host aliases, using a ID unique across a WOPI host instance as
part of the WOPI URL is a better approach that handles both of above
mentioned issues cleanly.
2017-05-23 17:05:07 +05:30
Henry Castro
41c561233d loleaflet: prevent default context menu of the grab handles
Change-Id: I12ede87cb8207257470720c130913e3ab7e967dd
2017-05-22 21:08:30 -04:00
Henry Castro
0ebedb7efa loleaflet: prevent default context menu of the row/column resize area
Change-Id: I184a698fd63a0b3e83efb8c315ccca730d56112a
2017-05-22 20:40:55 -04:00
Ashod Nakashian
e877adc84b wsd: don't stop doc on unauthorized loading
When a client connects with expired/invalid
access_token, the document should remain
active for other/existing clients, if any.

However, if no clients exists (i.e. the
first client has invalid access_token),
then the document should be unloaded and
cleaned up.

Change-Id: Iaad95a4286325cc6ee130b37e3ad635993a71c72
Reviewed-on: https://gerrit.libreoffice.org/37916
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-22 21:07:03 +02:00
Pranav Kant
62680fffdb loleaflet: Change opacity manually
See inline comment

Change-Id: I62456dd300eabaa156f9673fe13c190421c22ca0
2017-05-22 16:53:50 +05:30
Miklos Vajna
43eabc09d1 Fix HTTPWSTest::testInsertDelete() failure
.uno:DeletePage deletes the "current" page, while the intent here is to
delete all slides except the first one. Be explicit about this.

Change-Id: Ia8a8a5bf907e3d79cc646d54803447525375ce72
Reviewed-on: https://gerrit.libreoffice.org/37833
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-05-22 09:28:42 +02:00
Pranav Kant
1ea87b627e wsd: Arrange exception handling a bit
Remove incorrect usage of std::uncaught_exception and handle
StorageConnectionException later.

Change-Id: I15ecd46b51e8ed33649fe876d46ce3d5fbae07cc
2017-05-22 11:04:26 +05:30
Ashod Nakashian
4e6fee5407 Hide connecting spinner on authorization failure
Also, fix regression resulting in "This is embarrassing..."
instead of "Unauthorized..." message.

Change-Id: If6219bfbc445b186bb4064b3f20a0ccd2854d617
Reviewed-on: https://gerrit.libreoffice.org/37893
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-22 07:06:50 +02:00
Ashod Nakashian
7bc5989aca loleaflet: correctly reload after server recycling
When the server recylces, the client should
transparently restore connection when the
server is back on. This was broken because
of the different times when moving in and out
of focus for dimming/inactivity purposes.

Here we track server recycling state
separately, and skip the dimming/inactivity
checks in that case.

Change-Id: I432b97b3278b5a6846c8d2c4fa964184f156d5f3
Reviewed-on: https://gerrit.libreoffice.org/37892
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-22 07:06:14 +02:00
Ashod Nakashian
407c538f04 Correctly send termination reason to clients
Fixes the case when the client reconnects on idle
disconnection (because it never got the 'close: idle'
message).

Also, show informative message to users in this case
instead of grey screen.

Change-Id: Ia2e1f2ffefe6d35dd1552e7cc44e490aab86c600
Reviewed-on: https://gerrit.libreoffice.org/37891
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-22 07:05:28 +02:00
Ashod Nakashian
bdd8b715dd wsd: include cleanup
Change-Id: I9f28ee329e318043c31c899d3a07cd3139d838f0
Reviewed-on: https://gerrit.libreoffice.org/37890
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-22 07:04:24 +02:00