Commit graph

1412 commits

Author SHA1 Message Date
Tor Lillqvist
bb36ca79d4 Attempt to handle unauthorized WOPI usage better
Use the previously unused UnauthorizedRequestException for this, and
throw a such in StorageBase::create() when the WOPI host doesn't match
any of those configured.

In a developer debug build, without access to any real WOPI
functionality, you can test by setting the FAKE_UNAUTHORIZED
environment variable and attempting to edit a plain local file:
URI. That will cause such an exception to be thrown in that function.

Catch that UnauthorizedRequestException in
ClientRequestHandler::handleGetRequest(), and send an 'error:
cmd=internal kind=unauthorized' message to the client. Handle that in
loleaflet in the same place where the 'error: cmd=internal
kild=diskfull' message is handled, and in the same fashion, giving up
on the document.

Actually, using exceptions for relatively non-exceptional situations
like this is lame and makes understanding the code harder, but that is
just my personal preference...

FIXME: By the time StorageBase::create() gets called we have already
sent three 'statusindicator:' messages ('find', 'connect', and
'ready') to the client. We should ideally do the checks we do in
StorageBase::create() much earlier.

Also consider that ClientRequestHandler::handleClientRequest() has
code that catches UnauthorizedRequestException and
BadRequestException, and tries to set the HTTP response in those
cases. I am not sure if that functionality has ever been exercised,
though. Currently, we upgrade the HTTP connection to WebSocket early,
and only after that we check whether the WOPI host is authorized
etc. By that time it is too late to return an HTTP response to the
user. If that even is what we ideally should do? If not, then we
probably should drop the code that constructs HTTP responses and
attempts to send them.

Also, if I, as a test, force an HTTPResponse::HTTP_BAD_REQUEST to be
sent before the HTTP connection is upgraded to WebSocket, loleaflet
throws up the generic "Well, this is embarrassing" dialog anyway. At
least in Firefox on Linux. (Instead of the browser showing some own
dialog, which I was half-expecting to happen.)
2016-10-17 19:34:04 +03:00
Tor Lillqvist
b29ae3c032 Sort lines for clarity 2016-10-17 19:34:04 +03:00
Marco Cecchetti
e61d8aaa5f loleaflet: handle EMPTY invalid tiles msg with part in the payload
Change-Id: I73e363f51101c8e4e258131ea1692a7709d6a544
Reviewed-on: https://gerrit.libreoffice.org/29964
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2016-10-17 10:39:41 +00:00
Henry Castro
1d40b1eb79 loleaflet: fix mouse over text that it changes re-size cursor 2016-10-14 14:46:46 -04:00
Marco Cecchetti
78e707393e loleaflet: handle EMPTY invalid tiles msg with part in the payload
Change-Id: I84ae55440b540dc027bddf341994d34d411f2a3a
Reviewed-on: https://gerrit.libreoffice.org/29826
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2016-10-14 13:26:16 +00:00
Henry Castro
9d89989b99 loleaflet: remove unused query string 2016-10-13 17:03:48 -04:00
Andras Timar
cb4fb86794 loleaflet: add Insert - Comment to Calc menu 2016-10-13 12:58:04 +02:00
Henry Castro
fbfd500a2e loleaflet: fix style names in Layout dropdown 2016-10-12 21:51:48 -04:00
Henry Castro
25dce7a30f loleaflet: column/row re-size cleanup 2016-10-12 17:30:52 -04:00
Henry Castro
5a2fe805db loleaflet: add localizable error message 2016-10-12 12:44:44 -04:00
László Németh
f910dcbf88 loleaflet: tile debug: show tile render count and cached tiles
- show total number of the rendered tiles of the document, also
  the difference between the previous number in the client

- show cached tiles in transparent yellow color (in debug build)

- send ping messages after every invalidation message instead of
  keypressing

- fix memory leak: remove unused leaflet rectangle overlays on the
  tiles
2016-10-11 17:43:25 +02:00
Andras Timar
7ecf78a18e update pot files 2016-10-11 12:13:23 +02:00
Henry Castro
03f912115a loleaflet: do not show internal errors
Internal error message, it was intended for debugging purposes,
so it is not necessary to show them to final users
2016-10-10 16:03:30 -04:00
Pranav Kant
a01d2fc91d loleaflet: Restore old coloring algorithm for non-text documents
.uno:TrackedChangeAuthors doesn't give correct colors for
documents other than writer, lets use our old algorithm for color
assignment for these documents.

Change-Id: If865788154a80da2637aad84183a0e947bb4b7e8
2016-10-10 18:00:38 +05:30
Pranav Kant
176367b408 loleaflet: Fix incorrect reference to username
Change-Id: Ibd6433c862eaf5f5fe57244180691ef8b08e3fbb
2016-10-10 17:14:54 +05:30
Pranav Kant
0ad39593d0 loleaflet: Use view colors directly from core
Change-Id: I2fdffd6dd0823a77ff52e40150a81db4b261ec81
2016-10-10 13:02:22 +05:30
pootlebot automatic
29ce548144 Pootle automatic update from libo_online 2016-10-09 17:03:25 +00:00
Henry Castro
7f514422c3 loleaflet: increase re-size cursor zone 2016-10-09 11:43:26 -04:00
jan Iversen
83848bfb29 update from pootle 2016-10-09 09:42:29 +02:00
Henry Castro
0f86fde3e0 loleaflet: add .uno:AutoSum 2016-10-06 14:37:06 -04:00
Marco Cecchetti
fd3aba3be7 loleaflet: page-up/down - visible area is not scrolled as on desktop
Change-Id: Id6a61e93cd195cf731237961c0694685b2d497b4
2016-10-06 17:53:47 +02:00
Tor Lillqvist
c99379d67f The 'invalidatepreview' event handling seems to be unimplemented
No need to fire it if nothing happens. Just confuses a reader of the
code.

I don't really understand JavsScript events etc, so if I have
misunderstood something, feel free to revert.
2016-10-06 15:43:41 +03:00
Andras Timar
fd1991a961 Revert "loleaflet: add 'Freeze panes' item to View menu of Calc"
This reverts commit 81f374a940.
2016-10-05 16:01:07 +02:00
Andras Timar
81f374a940 loleaflet: add 'Freeze panes' item to View menu of Calc 2016-10-05 13:21:53 +02:00
Andras Timar
b5f95c2aed loleaflet: add Insert Footnote, Endnote, Page and Column break to Writer menu 2016-10-04 11:21:10 +02:00
Pranav Kant
7e57ae5dce loleaflet: Don't add these layers in readonly mode
Change-Id: I17437f53921dc3d5036be4a9650213a7eb0895dd
2016-10-03 11:16:32 +05:30
Henry Castro
4074587a12 loleaflet: the cell view cursor displays user name 2016-10-02 16:46:30 -04:00
Henry Castro
97fa8e45f9 loleaflet: fix error message localization 2016-10-01 11:35:19 -04:00
Miklos Vajna
81a114c47d DocumentRepair: still show the absolute time as a tooltip
Change-Id: I64cbf519e53c2a2ad697deb9932fb7a32e702d25
2016-09-30 17:44:54 +02:00
Miklos Vajna
655915da05 leaflet: bundle timeago JS module
And start using it in DocumentRepair.

Change-Id: I8d2b8af4d2e0dcc7cf8082c9d7adbc633df1c387
2016-09-30 17:12:01 +02:00
Andras Timar
d22cdad721 loleaflet: enable l10n of Update/Delete TOC commands 2016-09-30 16:33:38 +02:00
Andras Timar
b4d3bfdcae expose Update TOC and Remove TOC context menu items in Writer 2016-09-30 15:36:29 +02:00
Miklos Vajna
3090981c8a Document repair: expose user names, not only view IDs
Also in leaflet replace the current user with "You" to be consistent
with the statusbar.

Change-Id: If2d76f078eeae3038f8ae17506ae7679f7b23023
2016-09-30 14:21:14 +02:00
Pranav Kant
ec88a53072 loleaflet: loleaflet-font for userlist items too
Change-Id: If2c96d9d70a84bac1e75816f07bb7da8ff2642f5
2016-09-30 15:49:24 +05:30
Pranav Kant
7b60a9e3f6 loleaflet: Show error message dialog on diskfull
Set the mode to viewonly after the error so that user can still
see the tiles downloaded from the server, but cannot interact
anymore before server administrator fixes the disk space.

Change-Id: If03f4fabe93458672a631c020d09dcebecbb955c
2016-09-30 15:22:12 +05:30
Pranav Kant
42fbfa936c loleaflet: Use 'error' event to open the alert dialog
Change-Id: I8f1ca3d896027755fe1291cb227ded102e57e112
2016-09-30 15:22:12 +05:30
Henry Castro
b4ba3c9c55 loleaflet: fix mege mistakes 2016-09-29 17:57:17 -04:00
Henry Castro
e766e82f3d loleaflet: fix undefined variables 2016-09-29 17:41:10 -04:00
Henry Castro
3fcde8be83 loleaflet: fix show dialog error
Conflicts:
	loleaflet/src/core/Socket.js
2016-09-29 17:38:48 -04:00
Pranav Kant
d5f8c5b2e6 Change main websocket url for consistency with other urls
From
/lool/ws/docurl
to
/lool/docurl/ws

The main purpose behind changing this and other related urls is
to help in load-balancing. The first two parts of the URL can now
be used in a hash-based load-balancing algorithm which decides which
slave gets to serve the requests. Requests such as insertfile,
downloadas need to end up in the same slave in which document was opened.
/lool/docurl/ i.e first two parts of the URL are constant for all
the requests that should be served by a single slave.

Change-Id: Ibc605ca1251957b8b32b376cf19b78f6178fadfa
2016-09-30 00:50:57 +05:30
Pranav Kant
085a07b3e2 loleaflet: Ignore view messages before 'viewinfo' message
Change-Id: If0f759976f13a76c54c068a18bab5e07818cb86e
2016-09-30 00:33:58 +05:30
Pranav Kant
8330341a8a Include docurl in document download requests
From
/lool/jailid/randomdir/filename
to
/lool/docurl/jailid/randomdir/filename

Change-Id: I4d58e733768c62f2951ecfdcfcb604d99772862d
2016-09-30 00:33:58 +05:30
Pranav Kant
187abe0018 loleaflet: Remove unused fields
Change-Id: Ide180430cb2d359fa089ded8061af764c4001bb2
2016-09-30 00:33:58 +05:30
Pranav Kant
8c61ee3c94 Change insertfile URI to include doc key in it
From
/lool/insertfile
to
/lool/<docUrl>/insertfile

Change-Id: I63864673bc1d92a737a95b484c2f440cb5ce6605
2016-09-30 00:33:58 +05:30
Pranav Kant
12dee85ef8 Serve all assets (l10n, images etc.) versioned
Rather than accessing them using '/dist/', access them using the
version (git hash) in the url.

Change-Id: I999bd99a13dbf92b26641e3bd5c9e0b7468bb654
2016-09-30 00:33:58 +05:30
Henry Castro
940e78162f loleaflet: remove map attribution 2016-09-28 10:00:35 -04:00
László Németh
0b454bccfc loleaflet: cleanup of tile debugging mode 2016-09-28 13:21:01 +02:00
Henry Castro
c3568a6a41 loleaflet: refactor L.Control.Attribution.js 2016-09-27 17:28:30 -04:00
László Németh
459b5e585c loleaflet: show latency and other data in tile debugging mode
- show best, average, worst, last times of
  - server ping round trip
  - times between key press and invalidation message
  - tile based and total tile update latencies

- show data of the last five invalidation:
  - tilecombine messages, if they exist
  - otherwise the invalidation message
  - border of the last five invalidation rectangles

- visual fixes:
  - more transparent red color for better text typing
  - small letters over tiles with transparent background
  - black attribution text instead of gray + bottomleft position
2016-09-27 20:49:13 +02:00
Pranav Kant
bd40df2c97 loleaflet: Update view cursors when zoom changes
Change-Id: I58c8e71379b11c334c7a3cdd2d0b767d5b9d023c
2016-09-27 07:59:00 +05:30