Commit graph

1807 commits

Author SHA1 Message Date
Jan Holesovsky
7882fb34a8 loleaflet: Document .uno: command to change layout of the current slide. 2016-03-10 13:33:54 +01:00
Pranav Kant
3731f0c0d7 loolwsd: Avoid unnecessary copying
Change-Id: Iff888e5ff4577f20fae63a7b62ab1481ea2d71ed
2016-03-10 18:01:04 +05:30
Andras Timar
589261d9ed add Slovenian translation 2016-03-10 09:58:57 +01:00
Andras Timar
8c0764028f .gitignore 2016-03-10 09:55:19 +01:00
Ashod Nakashian
081ca0aa9f loleaflet: pass doc URI to WebSocket
Change-Id: I4798364c3ec655deb214cd3d7d93bbe3e83ad81a
Reviewed-on: https://gerrit.libreoffice.org/23110
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-10 04:25:06 +00:00
Ashod Nakashian
237e0c0e9a loolwsd: minor cleanups and const correctness
Change-Id: Ic3b26e1fbf5feba1667bc3dc1737d037590a5928
Reviewed-on: https://gerrit.libreoffice.org/23109
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-10 04:24:30 +00:00
Ashod Nakashian
e8214c1d2a loolwsd: refactored Storage classes
Change-Id: I3cc3aa2c1ddf70b8d2f3489aa4047f6470c93eb2
Reviewed-on: https://gerrit.libreoffice.org/23108
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-10 04:23:16 +00:00
Ashod Nakashian
05f8757f1d loolwsd: colored logs enabled automatically in tty
It is desirable to have colored logs when running loolwsd
in a terminal, but not redirecting its output to a file.

Outputting to a terminal is now detected and colored logs
are automatically enabled.

To force colored logs in files as well, define
LOOL_LOGCOLOR in the environ. The output color codes
can then be processed using, f.e., `less -r`.

Change-Id: I09fbee4441f210d814ac5ad23dd99d1c33b560b7
Reviewed-on: https://gerrit.libreoffice.org/23080
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 13:27:15 +00:00
Ashod Nakashian
cef1d842f9 loolwsd: added user-agent and response header logging to WOPI GetFile
Change-Id: Ia7fba845d67b27c25accb8515a44c57eed112a9b
Reviewed-on: https://gerrit.libreoffice.org/23054
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:36:52 +00:00
Ashod Nakashian
e5fcdb890e loolwsd: corrections to file and wopi URI handling
Change-Id: I7389a30931be01a40714167039055a758187bd82
Reviewed-on: https://gerrit.libreoffice.org/23053
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:34:10 +00:00
Ashod Nakashian
978147df55 loolwsd: refactored path manipulation in Storage.
Change-Id: I320c5638353b03df4fd0be612bb66c26e4f498a3
Reviewed-on: https://gerrit.libreoffice.org/23052
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:33:39 +00:00
Ashod Nakashian
18a224b413 loolwsd: Color logs can be enabled by defining LOOL_LOGCOLOR envar
Change-Id: I12a38562f05c5d0b5d1c970a4b67240167322daf
Reviewed-on: https://gerrit.libreoffice.org/23051
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:32:47 +00:00
Ashod Nakashian
83880c454f loleaflet: removed unnecessary token parameter sent to WSD
Change-Id: Ibdef21665fcbf65c95870c8711321f63f7098596
Reviewed-on: https://gerrit.libreoffice.org/23050
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:32:19 +00:00
Ashod Nakashian
6c69519562 Storage is used to manage files locally
Change-Id: Id50eca8fe1136777ca99c60d78c15e1a47397993
Reviewed-on: https://gerrit.libreoffice.org/23049
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-09 02:31:47 +00:00
Pranav Kant
1d511b109a loleaflet: Subscribe to appropriate commands
Change-Id: I0f6571a453fb8850902003d1cc2fecafa5eb4474
2016-03-08 15:14:20 +05:30
Pranav Kant
afb7e7dcff loolwsd: Make clients subscribe to commands
... for which they want to be notified.

Needed to add some missing header files to Storage and Auth class
because of conflict raised when LOOLWSD.hpp is included in
Admin.cpp

Change-Id: Ia1c8ed82f8cd979eaf93267ae5dfa347acf895f4
2016-03-08 15:14:14 +05:30
Pranav Kant
ee54f2abbb loleaflet: Split admin JS files into multiple
And then combine into one during build for distributing. We would
also want to minify the combined JS file but that is for later.

This come up rather early than anticipated, but good for us.

Change-Id: I74feb4955c5d47f0e9e817b410726ad219add485
2016-03-08 15:12:28 +05:30
Pranav Kant
f8a21a783e loleaflet: 'vex'ify
Change-Id: I016817fb5a2429d572e789f2fe5d2f25a9c3c883
2016-03-08 15:12:19 +05:30
Pranav Kant
5cc204ba71 loleaflet: Add support to kill children
Additionally, move jquery <script> tags up because we need jquery
to add context menu to table rows as soon as page is opened
(socket is opened, in this case).

Change-Id: Ic6e28486fb96f119e7d41168fc0039265f15a087
2016-03-08 15:12:12 +05:30
Pranav Kant
7fd206e61e loleaflet: Add jquery to assets/
If CDN doesn't respond, load jquery from dist/

Change-Id: I8073735996d574f652b757d899c191bcefe03a7c
2016-03-08 15:12:06 +05:30
Pranav Kant
943d9a517e loleaflet: Add total memory, active users, active/open docs
Change-Id: Ie92ca10d9fb892daf45c17edd58b464c9f7cc09b
Reviewed-on: https://gerrit.libreoffice.org/22990
Reviewed-by: pranavk <pranavk@collabora.com>
Tested-by: pranavk <pranavk@collabora.com>
2016-03-08 09:40:58 +00:00
Pranav Kant
76542d8d52 loolwsd: Add total memory, total active docs, total active users
Further changes/refactoring to make it possible:
* Add broker pid to Admin class
* Move getMemoryUsage for process to Util
* Change variable name to accurately reflect *active* items
  _nViews -> _nActiveViews, etc.

Change-Id: I4c9206c49ab829b73ebfe226874bfbbcc8f95342
Reviewed-on: https://gerrit.libreoffice.org/22989
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-03-08 09:34:51 +00:00
Pranav Kant
e366aa8e0b loolwsd: Support for killing children
Change-Id: Iab62a7e0dab7732f552a1b5f9eb5f67a5b96d74a
Reviewed-on: https://gerrit.libreoffice.org/22991
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-03-08 09:33:12 +00:00
Pranav Kant
e7f75a3e56 loolwsd: Wait for all admin client threads to finish
Otherwise the process could terminate while admin sessions are still
being served.

Change-Id: Id91d0989e264e8294827e8e2ad8dd2d44b6006ec
Reviewed-on: https://gerrit.libreoffice.org/23021
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-03-08 09:08:16 +00:00
Tor Lillqvist
e8a5ba1b29 _bShutdown is always false 2016-03-08 09:45:23 +02:00
Tor Lillqvist
e7e1ef58ae Cosmetics: Sort and prune #include and 'using' lines 2016-03-08 09:44:04 +02:00
Tor Lillqvist
61ee1ae842 Use std::getenv() instead of Poco::Environment::get()
Much simpler.

Also, don't duplicate the code informing that LD_BIND_NOW or
LOK_VIEW_CALLBACK are not set. Not that I understand why we need to
inform about that? If the "normal" thing should be that they are set,
why don't make it so by default then?
2016-03-08 09:16:01 +02:00
Tor Lillqvist
7d89cfa6f0 Clean up #includes and usings.
Include and use 'using' only for what is actually used. Sort the
include and 'using' lines.
2016-03-07 20:00:35 +02:00
Tor Lillqvist
9947633550 Catch IOException from sendTextFrame() in LOOLSession::disconnect()
Otherwise the uncaught exception will terminate the loolkit process
unexpectedly, which surely messes things up.
2016-03-07 20:00:35 +02:00
Tor Lillqvist
06c6a7e1a6 Try harder to avoid deadlock
I occasionally saw a deadlock when running 'make check' where one
thread holds the ChildProcessSession::Mutex and wants the _mutex for a
Document, while another thread holds that _mutex and wants the
Mutex. In particular, it is the Document::onUnload() that wants the
_mutex. So avoid the deadlock by having Document::onUnload() first
take the ChildProcessSession::Mutex.
2016-03-07 20:00:13 +02:00
Tor Lillqvist
9f67eecadd Improve exception logging
Always try to identify *where* we caught the exception. It is not that
useful to have half a dozen places that all just log "Exception:".
2016-03-07 18:36:01 +02:00
Tor Lillqvist
8fc4f1d95f 10 seconds is a bit short 2016-03-07 17:44:54 +02:00
Tor Lillqvist
d27e798e0f It is not only a 'segfault' that is handled here 2016-03-07 17:44:11 +02:00
Tor Lillqvist
80c6a91d5d Don't call setcap on loolkit before we have built it
On the other hand, loolwsd does not need capabilities any more.

Also update the comment to match reality, and explain in more detail
what is going on.
2016-03-07 13:10:45 +02:00
Tor Lillqvist
e96629b371 It is apparently intended that one uses the mocha built here, not a system one
On many/some distros, the system mocha is a much (?) older version,
which uses a wildly different output format, which is confusing.
2016-03-07 13:04:42 +02:00
Tor Lillqvist
636fafa3b6 We use a recursive mutex, so no need to drop and re-take around documentLoad()
The callbacks from documentLoad() are made in the same thread.

Sure, as such it is not a good thing to use recursive mutexes. If we
switch back to non-recursive mutexes, we will have to stop taking the
lock in callbacks from documentLoad(), i.e. make sure we know those
functions aren't used elsewhere, in places where a lock would be
needed. Or something.

If a client session closes just after sending a load message to load a
document, and another session then fairly immediately connects and
sends a load message for the same document, the latter session gets
handled by the same kit process. Also, the same Document object is
apparently used. In that kit process, the first documentLoad() might
easily still be in progress. The handler for the new session still
calls onLoad(), too, and as the first onLoad() had dropped the lock
for the duration of the documentLoad() call, the new onLoad can take
the lock and call documentLoad(), too, while the first documentLoad()
call in the other thread still is in progress. This leads to
interesting problems.
2016-03-07 12:57:18 +02:00
Tor Lillqvist
0194e8d577 Use assert()
It is loolwsd that spawns loolbroker so we control what arguments it
gets, so no need to give verbose errors if our own code is
inconsistent. That is what assert() is for.
2016-03-07 12:57:18 +02:00
Pranav Kant
cd58f2a491 loleaflet: Better design for Admin console JS files
Lets have a new websocket class for each websocket type we want
in admin console inheriting from single abstract base class.

This, hopefully, would provide us with extensibility and ease of
managing files in future. Right now, there is only one class with
very less complexity, hence all the code is in one file.
As the complexity increases, we would need to separate all these
classes in different files, concat and compress them before moving
to dist/

Also rename dashboard.html to admin.html

Change-Id: I34b9b2817fe4a0e6ee2913c017d2694a17ab978c
Reviewed-on: https://gerrit.libreoffice.org/22904
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2016-03-07 10:56:59 +00:00
Pranav Kant
1ab3caa192 loleaflet: Make SearchSpec work again
This broke after we changed 'searchAll' to 'highlightAll'.

Change-Id: I257b20a458a9ad3334b5e20fc110d0932eb63733
Reviewed-on: https://gerrit.libreoffice.org/22508
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2016-03-07 10:09:07 +00:00
Pranav Kant
a6f9cd430b loleaflet: Wait for 'partpagerectangles' before starting search
This is required because we want to test on which page search is
found, and we can not do it before we get results for
partpagerectangles.

Change-Id: I6f927ae27b91e62d86a8e46dc9c21ee9aa913894
Reviewed-on: https://gerrit.libreoffice.org/22507
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2016-03-07 10:07:52 +00:00
Miklos Vajna
0fc711c9a1 loolwsd: fix -Werror=maybe-uninitialized 2016-03-07 09:51:22 +01:00
Miklos Vajna
6ef8312357 loolwsd: fix -Werror,-Wshadow 2016-03-07 09:09:32 +01:00
Pranav Kant
10ba772006 loleaflet: Basic template for Admin console
Work based on bootstrap: http://getbootstrap.com/
License: MIT

Change-Id: I6a114e8dd688339c809ff27d97d0065647700971
Reviewed-on: https://gerrit.libreoffice.org/22824
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2016-03-04 13:28:01 +00:00
Pranav Kant
ea35385e18 loleaflet: Special handling for Impress docs on state change
State changed event from LOK for impress documents is
prefixed with the template name followed by the style name. Lets
strip the template name for the time being till we support it in
the UI.

Also LOK emits some form of internal names in state change event
which is different from the internal names supplied to us in
intial .uno:StyleApply. For consistency, convert these names to
our original form of internal names.

Change-Id: I95d3d8aa29238fc326887cdfc9b22eb4e429d1bb
Reviewed-on: https://gerrit.libreoffice.org/22814
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2016-03-04 13:27:16 +00:00
Pranav Kant
9d7aea26b9 loleaflet: Add programmatic -> UI names mapping to l10n framework
Since the data scraped from the LO translation module is a
mapping between the UI names (not internal ones) to different
languages, the plan is to first set the locale explicitly to
'libreoffice' so that l10n framework gives us corresponding UI
names from programmatic names, and then to use the specified locale to
translate these UI names to respective languages.

Change-Id: I64f7c9b4927e5effe328cb7b42582b45d44167d9
Reviewed-on: https://gerrit.libreoffice.org/22813
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2016-03-04 13:26:43 +00:00
Tor Lillqvist
80d9610432 Update from LO master 2016-03-04 12:09:14 +02:00
Tor Lillqvist
6859c85543 Factor out function to get the symbolic name for a LibreOfficeKitCallbackType 2016-03-04 11:49:46 +02:00
Tor Lillqvist
28fd1ace0c Make it clearer in the logging which callback is which 2016-03-04 11:32:25 +02:00
Pranav Kant
87a3b5d3ac loleaflet: Fix JS errors
Change-Id: I9740e0a223c43449ce9f40f91b8c90250d1b7560
2016-03-04 13:17:23 +05:30
Ashod Nakashian
743311af21 loolwsd: added wopi storage manager
Change-Id: Ia28fb3d42c43387432e0b183a1bcf6b0924da820
Reviewed-on: https://gerrit.libreoffice.org/22885
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-04 03:06:28 +00:00