This resolves a dependency on userName
(a.k.a. UserFriendlyName) that was a source
of issues when missing.
It turns out that when it's missing but
spellOnline is set, an edge-case caused
an exception that failed loading.
The spellOnline value, in its turn, was
incorrectly set to "null" when in fact
it was missing. This resulted in online
spell-checking being active by default.
Perhaps this was intentional, but here
we don't change this behavior at all.
Instead, we avoid sending "null" when
it's missing, and by default we always
enable online spell-checking, unless
it is explicitly set to "false".
This way, the exception is not thrown
and spellOnline doesn't have invalid
values, while preserving the current
behavior.
Change-Id: I4a09ac44ff5d6147c715afa0fb34af9650da4afd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The "extends": "eslint:recommended" property in a configuration file enables this rule.
In ECMAScript 5.1, Object.create was added, which enables the creation of objects
with a specified [[Prototype]]. Object.create(null) is a common pattern used to create
objects that will be used as a Map. This can lead to errors when it is assumed that
objects will have properties from Object.prototype. This rule prevents calling some
Object.prototype methods directly from an object.
Additionally, objects can have properties that shadow the builtins on Object.prototype,
potentially causing unintended behavior or denial-of-service security vulnerabilities.
For example, it would be unsafe for a webserver to parse JSON input from a client and
call hasOwnProperty directly on the resulting object, because a malicious client could
send a JSON value like {"hasOwnProperty": 1} and cause the server to crash.
To avoid subtle bugs like this, it's better to always call these methods from Object.prototype.
For example, foo.hasOwnProperty("bar") should be replaced with Object.prototype.hasOwnProperty.call(foo, "bar").
See: https://eslint.org/docs/rules/no-prototype-builtins
Change-Id: Id7723f0f0ed81e074f56955f80eda3d70241294e
Signed-off-by: Ayhan Yalçınsoy <ayhanyalcinsoy@pisilinux.org>
Fixes problems particularly with the new Chrome where the original
approach to tiles can be causing blurry text.
Change-Id: Icf598df0e997d493b111fad1c59e7dcb5f376801
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103681
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
The file is not part of the leaflet files.
It is better to move it to the external library location
Change-Id: I12fb9684571db360b03a2e7c343725fd42b6848a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103419
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
makes UI more consistent with notebookbar
some tooltip used to go out of screen on edges
Change-Id: I306591146c21cc9d4f2d92361f411628a91f3d89
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102277
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
This fixes the mouse wheel - now it works on the chromebooks.
Change-Id: I5bf2a7e1ae397ef171221ac58172940bb43cbb3c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100227
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
This should be initialized when html is loading
Change-Id: Ief99d3a613ddaa86caaf5285795a97e3f56787b5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99511
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro@collabora.com>
Due to security reasons, the access object from IFrame
is restricted and throw exceptions. So always return false
by default when using this component.
Change-Id: Ib297ee49c563c2d4c6eb63a794284d3d3cfe79e8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98978
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Running a local nextcloud instance, it throws an uncaught type error.
Change-Id: I48f553f4e4a4704fa4f2753e9af5207c4d95e5f9
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98977
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro@collabora.com>
Chromebooks are not touch devices, the desktop browser-like UI makes
much more sense there.
Change-Id: Id963929e781f2baff32a65e0437afb4dfd8460a3
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98865
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Current replacing url strings method works fine,
however, it does not cover all the rules
for cases like when @media or @import are used.
They have a subset of their own rules which must
be covered as well.
Change-Id: Ib10f7cc361aea5cd3b855f64e3a64566a6c51a12
Signed-off-by: mert <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97071
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Websockets don't magically re-connect, so we shouldn't either.
Also avoid starting our send interval timer until we've opened
to simplify.
Change-Id: Id71049da2d4b4d0ac2f38a3d7410f2446d04f0b1
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95906
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
If our 'open' request fails - then we could get this loop:
loadDocument (proxy.php?req=/loleaflet/d2d049224/src/map/Map.js:318)
_activate (proxy.php?req=/loleaflet/d2d049224/src/map/Map.js:1233)
_onSocketClose (proxy.php?req=/loleaflet/d2d049224/src/core/Socket.js:1045)
_signalErrorClose (proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:576)
(anonymous) (proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:688)
load (async)
getSessionId (proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:682)
global.ProxySocket (proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:753)
global.createWebSocket (proxy.php?req=/loleaflet/0acb00fc2/loleaflet.html?file_path=file:///tmp/copy.odt:798)
connect (proxy.php?req=/loleaflet/d2d049224/src/core/Socket.js:52)
loadDocument (proxy.php?req=/loleaflet/d2d049224/src/map/Map.js:318)
Which would hammer the server with large numbers of requests triggering
DoS protection in some cases, so:
1. only allow one 'open' in-flight at a time
2. global time-accounting to not allow >1 new ProxySocket every 250ms
3. handle error returns from 'open' correctly.
Change-Id: I1692acd72a445ebc70a83c66a2e802a532c66e21
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95837
Tested-by: Jenkins
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
reuse_cookies is now always encoded in the URL.
And, there is no need for the WOPISrc in the three cases
in this patch, and by passing the DocumentURI proper
(without /ws?WOPISrc=...) ensures that all query-params
in the DocumentURI are properly processed.
This fixes the reuse_cookies regression where it
wasn't passed to WOPI requests.
Change-Id: I8dccfb09a7b4102d10c1aef24f43b699a07bfed8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95293
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
When there is no data coming in from WSD, we slow
down the frequency of invoking RichProxy.
Supports recovering from errors and server restarts
or document unloading (i.e. when the session is
invalid).
We don't invoke RichProxy more than 40 times a second
(i.e. with 25ms interval) and we slow down when
the last data was received 3x longer than the
polling interval. The current decay rate is 15%.
That is, we throttle to 1.15x the last interval.
This brings us down from 25ms to 500ms in about
4 seconds, which is very reasonable.
However, when we want to send data, or when we do
receive any data, we immediately maximize the
frequency so we can communicate as fast as possible
and reduce the user-visible latency. Notice that
when we get some data (without having sent anything
recently) it implies activity from another user,
so we do want to get their changes in real-time.
This is why we reduce the polling frequency
gradually, but increase it abruptly.
The parameters of the algorithm are configurable
directly in the code, but the current defaults are
very reasonable.
Change-Id: I0b9fd6db73caa35853fe6d8077bef66934de679c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94654
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Reuse cookies are captured on file-serving the
loleaflet.html, whereupon they are injected
into it before serving as part of the document
load url. They show up as &reuse_cookies=
in the url embedded in loleaflet.html.
When loading the document, and creating
the session, the cookies received via
reuse_cookies is stored and set in each
WOPI http invocation.
This restores creating reuse_cookies in the
URL. It was inadvertently dropped after some cleanup.
Change-Id: I6de8ddb58e7f43566a08c22327dbc4b7a1207388
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94472
Tested-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
This patch allows the lok core to know about the device form facor of
the client requesting the creation of a new view, immediately instead
of a later time.
When a request for a new view is sent a 'deviceFormFactor' parameter
is appended to the message.
This parameter can have one of the following values: 'desktop',
'tablet','mobile' and is forwarded to the lok core.
Change-Id: I21739ddb8c43c960164b3c625e4cf0a80f4616a4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92691
Tested-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>