Commit Graph

101 Commits (master)

Author SHA1 Message Date
Michael Meeks ff8dbe7fde cool#9045 - close clipboard race by waiting for completion.
To avoid the HTTP[S] request racing the websocket and sometimes
loosing we need to:

* get a notification from the Kit when the copy / cut is complete
* wait on a Promise for this, to allow the HTTP fetch to start
* re-work to do a single, rather than two fetches by sharing
  the download promise.

Change-Id: Ic23f7f817cc855ff08f25a2afefcd73d6fc3472b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-05-14 13:19:52 +02:00
Miklos Vajna 7f9de46688 cool#8465 clipboard: improve handling of plain text copy, simple case
Currently the current selection is always requested as HTML by the
browser, and then we ask the browser to convert it to plain text.

The problem is that e.g. Writer can produce much better plain text from
its model, compared to the plain text by the browser, e.g. bullet
characters for bullet points.

Fix the problem by:

- CanvasTileLayer.js, _onTextSelectionMsg(): requesting both HTML and
  plain text. Use ',' as a separator, as that's already established,
  e.g. the HTTP Accept header does that already

- Switching the textselectioncontent protocol message from just HTML to
  JSON that contains both HTML and plain text. This is produced in
  ChildSession::getTextSelection() and parsed in CanvasTileLayer.js,
  _onMessage()

- Clipboard.js, setTextSelectionHTML(): allowing setting both HTML and
  plain text.

- ClientSession::postProcessCopyPayload(): knowing if the content to be
  processed is HTML-in-JSON or just HTML, do additional escaping in the
  JSON / textselectioncontent case, but leave the other clipboardcontent
  case unchanged.

So far this only handles the simple case, the behavior for complex
selections are left unchanged for now. The payload is also unchanged
when a single format is requested, as many tests depend on test.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I2fe1378a8d50b7901ac9e808eb78858cd8ff8575
2024-03-08 13:54:10 +00:00
Michael Meeks 7382a56591 latency: switch tileprocessed to track wire-ids per-connection.
To manage latency, we need to keep the amount of data-in-flight
manageable, this was previously done per-tile - however this is
less useful in the era of small deltas, and seems over-complicated.

Instead track processed tiles by their wire-id to save time,
space & bandwidth.

Change-Id: I1039d8d4ca96fb172278a824fe1ffd55d9fff23e
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-12-09 21:56:01 +00:00
Areg Nakashian 8a735d4faf Remove unused requestloksession command
This removes the unused requestloksession command
and all references to it, including protocol documentation.

Signed-off-by: Areg Nakashian <ss4crifice@gmail.com>
Change-Id: I8c410460a5f500f724996fbcbf8f9650028daaf9
2023-10-24 21:35:38 -04:00
Rash419 3c20783ac6 admin: added id field in verifyauth msg
- this id will help to identify which adminClusterOverview socket
  has sent verifyauth message from controller

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ic09b33c9eb2c0072f84b7147acc673031dbac0d8
2023-10-10 13:10:44 +05:30
Rash419 9d6b1d148b don't request new tiles unnecessarily on canonicalidchange
- it applies for 2 cases:
1. when document is loaded for the first time document already has
tiles of respective theme
2. when Kit loads the document it sends canonicalidchange  unconditionally
(5520965b15/kit/Kit.cpp (L1708))
we don't need to request new tiles for that also

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I42cdc5a03e70c3d3d653f3124d3d5ed9382e22c0
2023-10-02 13:29:25 +05:30
Caolán McNamara 084e715dc6 TileDesc broadcast field is always false
apparently since:

commit b0a7532b08
Date:   Sat Nov 14 19:43:02 2020 +0300

    Turn off broadcast on presentation preview tiles

so drop this field from TileDesc and protocol.txt

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib4b1eca0d30911e13c245551cb3e3261afc99dd2
2023-09-11 09:38:49 +01:00
Rash419 303001623f admin: use sendTextFrame for verifyauth msg
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ib5c4144df168f5a649ce2a4a3a8690eb9de0f723
2023-08-28 10:29:29 +05:30
Rash419 319c6e4570 admin: add new command to verify auth token
- original auth command shutdowns the socket connection
  if the token is invalid
- in controller's case we just want to verify the token
  for adminClusterOverivew socket connection

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I2e640a746c839ea6f4494ddbdfcb8f924150906f
2023-08-28 10:29:29 +05:30
Caolán McNamara aaa61e44e5 allow tileprocessed to accept multiple comma-seperated tileids
and bundle them together when emitted from the browser-side

// i.e. FIXME: new multi-tile-processed message.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I69916cbe30c26686fb44a2d8d229704c459b6601
2023-08-04 13:07:29 +01:00
Michael Meeks d309d7199a deltas: fold the update: command back into an empty delta: command.
Also: address parts of #6897, primarily:

* remove the problematic aspect of bumping the last wid in our
  TileData, when this could trigger a re-send of a previously
  sent delta, causing tile corruption.
    * instead append an empty wid entry.
    * as an optimization - if the last entry is empty update
      the wid - since re-sending an empty delta is of no
      concern.

* simplify a number of code-paths that special-case zero length
  deltas. All deltas now commence with 'D'.

* still track updates in the JS - by detecting empty deltas.

* shares more code and simplifies various paths.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I02af6d4b152524c201b6985b7a3497da7f08a517
2023-07-17 11:35:25 +02:00
Michael Meeks 789dd2963c Append the wid properly to invalidatetiles and parse it too.
also re-work parseInvalidateMsg to not use std::pair<> returns.

Change-Id: I724783b7050a1ee251dfbe9b2f1e0ea02e7d45f2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-08 13:08:59 +01:00
Michael Meeks 61aa932d30 Send an 'update' message for an un-changed tile when rendered.
Change-Id: Iefe666f9953195af0001626a9e8d7d080a7fe201
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-03 20:27:07 +01:00
Rash419 9d1741232b admin: added wopiSrcMap command
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I95a7ccec6075848bd18b8899119c720aa303a106
2023-06-29 18:21:33 +02:00
Rash419 b717be603e implement document migration
- updated protocol.txt

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I67a0515580979e15223ea084c835f5ed801ceb5e
2023-06-29 18:21:33 +02:00
Michael Meeks 12e0830b1b Kill canceltiles support completely.
This stopped working well a long time ago, and is already disabled
on the coolwsd side, so dung out the rest of the code & docs on this.

Change-Id: I2e0b73fe9780e16c3cc74ae3a38ae6b04434717a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-22 09:35:22 +01:00
Gökay Şatır 9d6296e4b3 Remove unused document signing code.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I30cf381d1fa282cf222ab5abc676374ab7eefb6c
2023-05-08 21:51:47 +03:00
Rash419 58d66fca59 admin: notify routing_rmdoc to subscribers when all views expires
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I360b90d2b93ce9e8508f16822a2654e111ba2407
2023-03-13 08:07:16 +01:00
Ashod Nakashian 0f9dc9460b wsd: support per-user timezone
Change-Id: I5e2318a34cb39d8d56ec3cf4977ebd75588a7627
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-31 15:38:08 +01:00
Rash419 c5fd805619 admin: added new admin->client command
routing_rmdoc command is added specifically to notify indirection url
server about document getting removed with its wopiSrc

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ic077f210d520394e3ef8ced778604b7343436328
2023-01-31 15:32:30 +01:00
Rash419 2529fa9ee2 notify client when route tokens get updated
- once client get notification it will update the routetoken
by refetching it from indirection url endpoint
- added support to configure indirectionurl enpoint using
remote config

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Iead22af56c655bdece6b70cc4e97a1fa401b1bae
2023-01-31 15:32:30 +01:00
Ashod Nakashian 1b80a7b722 protocol: minor documentation fixup
Change-Id: I0f178d7753e5cc787680314c2e5ff0f50ff52b39
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-12-22 10:10:08 +01:00
Jan Holesovsky 7f96d9276c Implement HideRepairOption in CheckFileInfo
When present and equal to 'true', the 'Repair' button and/or menu entry
is hidden in the UI.

Signed-off-by: Jan Holesovsky <kendy@collabora.com>
Change-Id: If8075be479551e0d1a5fa03014aa5e4412578c31
2022-10-18 13:02:11 +02:00
Rash419 b54466a97b contentcontrol: updated protocol.txt
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I1c2b7b446d72782d987ee3a952731b78fcfc4caf
2022-06-15 11:04:18 +05:30
Michael Meeks c130231379 deltas: track, transmit and cache deltas (disabled for now)
Squashed from feature/deltas-expanded.

TileCache changes:
    + add montonic sequence (wid) numbers to TileData
    + account for sizes of TileData with multiple blobs
    + simplify saving and notifying of tiles

Sends updates (via appendChanges) based on the sequence the
right mix of keyframes and/or deltas required as a single
message, and parse and apply those on the JS side.

We continue to use PNG for slide previews and dialogs,
but remove PngCache - used by document tiles only.

Annotates delta: properly as a binary package for the websocket.

Distinguishes between deltas and keyframes we get from
the Kit based on an initial un-compressed prefix
character which we then discard.

kit can be forced to render a keyframe by oldWid=0

Track invalidity on tiles themselves - to keep the keyframe around.

    We need to be able to track that a tile is invalid, and so subscribe
    to the updated version as/when it is ready - but we also want to
    store the keyframe underneath any deltas.

force rendering of a keyframe for an empty slot in the TileCache.

force tile sequence to be zero for combinedtiles - so the client can
always request standalone tiles with explicit combinedtiles, or tile
requests.

move Blob to Common.hpp

use zero size for un-changed tiles.

remove obsolete render-id, and color deltas in debug mode.

cleanup unit tests for non-png tile results.

Change-Id: I987f84ac4e58004758a243c233b19a6f0d60f8c2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-24 22:16:58 +01:00
Miklos Vajna cdb92d2237 wsd: add initial protocol documentation for paintwindow and windowpaint:
As Tor noted on IRC, this was forgotten when the actual protocol
commands were introduced.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I548ac73348bceb469484ce934f7548ddb4091b63
2022-05-06 13:56:42 +02:00
Luboš Luňák 1dfb6d3866 handle properly "EMPTY" invalidatetiles message (T32137)
ChildSession::loKitCallback() may generate a message in the format
"invalidatetiles: EMPTY, 0". Handle it properly in tests.

Signed-off-by: Luboš Luňák <l.lunak@centrum.cz>
Change-Id: If8009be3c4ce031466ed304df7028848a8ab960f
2021-12-13 22:08:25 +01:00
Andras Timar f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00
Andras Timar de3e09fde0 rename wsd protocol command 'loolclient' to 'coolclient'
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I506fe74bc5ebf183ed21721b40a45210373abf06
2021-11-17 11:59:35 +01:00
Andras Timar ec8f28d75c rename wsd protocol command 'loolserver' to 'coolserver'
Change-Id: I1835001b76da5179baab9820a1a60208f3e694cf
Signed-off-by: Andras Timar <andras.timar@collabora.com>
2021-11-17 11:59:35 +01:00
Mert Tumer 81f61c8073 rename: loolforkit -> coolforkit
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I1de688dce4b068bff35451604486b72ecc8c91d4
2021-11-16 21:02:24 +01:00
Jan Holesovsky d264fa61eb Change some unwanted renames
Signed-off-by: Jan Holesovsky <kendy@collabora.com>
Change-Id: I9ab7c701470ca9b81e5a71812683860175e18542
2021-11-11 16:42:03 +01:00
Henry Castro 2e8ce9421a wsd: update protocol.txt, rename loleaflet -> browser
Change-Id: Ie3c350eb619fee5aec0c4e00a1373bb19c3f935e
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-10 17:18:56 +01:00
Tor Lillqvist 522431a82e We generate 'S' and 'F' "Async" Trace Events in loleaflet, not 'b' and 'e'
"Async" here refers a specific kind of data in the Trace Event JSON
format, not asynchrony in general.

Actually, we don't have code that would generate such yet in
loleaflet. Just the createAsyncTraceEvent function in Socket.js. Quite
possibly the "Complete" events (a.k.a. ProfileZones) are all we need.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I611ccd4b964bcacdd1050893f70dbdb813ee3c34
2021-07-21 13:26:23 +03:00
Tor Lillqvist 4c68a97ce5 Re-factor Trace Event stuff for improved functionality and thread safety
Write to the Trace Event JSON file in just one place, protected by a
mutex.

Handle metadata events separately. We want them to propagate to the
output if Event Trace generation is just enabled, regardless whether
it has been turned on or not.

We can send the metadata for the Kit process only after we have opened
the docuemnt as sending a Trace Event to WSD uses the (singleton)
Document object in Kit.

Introduce some new functions for the above and adapt callers
appropriately.

Generate a Complete event for the handling of one image tile, from
setting the src attribute of the Image object to finishing the onload
function.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I5978e0fb2495e0d2dc479bf861eb4ac7da03fa50
2021-06-21 12:43:17 +03:00
Tor Lillqvist eee8fe99d5 Avoid maximum/minimum logging level terminology for newly introduced settings
(Also in variable names.)

Better to just use terms that say what we mean, i.e. most verbose and
least verbose.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I80d74fda8b80bd34d194c3df97d246a41368189b
2021-05-31 15:06:57 +03:00
Tor Lillqvist b7ca93a41a Add the possibilty to set a thread-local logging level
Add a way to set it from the client.

For now, in the Help > About dialog, the L key toggges the logging
level between the default (whatever is set in loolwsd.xml or on the
loolwsd command line) and the maximum a client is allowed to set
(which also can be set in loolwsd.xml or on the loolwsd command line).

Also while at it, uncouple the toggling of the Trace Event generation
from the triple-click tha toggles tile debugging. It is now on the T
key.

Also swap the meaning of "min" and "max" for the logging levels. Even
if the Poco::Message::Priority values are such that the less urgent
priorities have a numerbcally higher value, conceptually it is more
clear to say the more urgent priorities (levels) are "higher".

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I5383b16ead7d2d378901525eb0d16513d88f045e
2021-05-31 10:56:19 +03:00
Tor Lillqvist cadb005993 Add the possibiliy to include arbitrary arguments in the generated Trace Events in JS, too
For now, an argument object should have all keys and values as strings
not containing any spaces because of the trivial way in which it is
parsed.

This is a bit sad, yes, but necessary until we move to some more
structured syntax for the messages.

Also fix an incorrect comment.

Change-Id: I8a1408a4a1787b66a3cf7b26b3d92c07df244c47
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-19 13:33:26 +03:00
Tor Lillqvist 9c57b8a435 Introduce a TRACEEVENT message from client to server
Add a function emitInstantTraceEvent() to leaflet that sends an
"Instant" Trace Event to the server for logging.

Add a function createAsyncTraceEvent() that creates an object that
records the timestamp of its creation and sends the 'b' event to the
server for logging, and when you call finish() on the object, sends
the corresponding 'e' event.

Finally, add a function createCompleteTraceEvent() that creates an
object for a "Complete" Trace Event that includes the end timestamp
*and* the duration. The event is sent to the server when you call
finish() on the object.

Loleaflet sends timestamps in the above messages from
performance.now(). To enable the server to turn those into absolute
timestamps, the loolclient message is amended to include the current
Date.now() and performance.now() values.

Note that the intent is that when generating Trace Event logs, the
server and the web browser run on the same machine, so there is no
wall-clock synchronisation issues between server and client.

Change-Id: Ie9e68b093b769cc942e1e1d17083febeb07ccf5e
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-06 11:24:20 +03:00
Tor Lillqvist eb9c580c36 Introduce ways to toggle and tweak core Trace Event recording and logging
When toggling tile debugging in the Help>About, toggle Trace Event
recordning, too. Add a comment with an example of how to turn on
SAL_LOG overriding at the same place.

The following new messages from client to server are introduced:

traceeventrecording <start/stop>

    Starts or stops comphelper::TraceEvent recording.

sallogoverride <string>

    Overrides the SAL_LOG value, or stops overriding if no parameter
    or parameter is "default".

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I8b56c28cd99d39115cd796c44e5051d934d21a1f
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-03 16:09:35 +03:00
Tor Lillqvist b92e13de96 Add an ERROR message from client to server that is logged with LOG_ERR()
Change-Id: If9f3316bb07f68b609c96135227a3e06a1112786
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-26 15:24:08 +02:00
Tor Lillqvist e60f972b05 Correct description of handling of the DEBUG message from the client
Change-Id: I19fd4ed92315908af36362368ee2fdbc8558c2ae
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-26 14:38:46 +02:00
Tor Lillqvist 5642e89ccf Add handling of a "DEBUG" message that is just printed to stderr
This is useful in situations where you can't get at console.log()
output from the JavaScript, like when you are using the Nextcloud iOS
app installed from the App Store and want to debug the loleaflet
offered by a Collabora Online server you are using. You can add code
like

    this._map._socket.sendMessage('DEBUG Foo bar=' + bar);

temporarily to the JavaScript and will see those then in the terminal
where you run 'make run.'

Change-Id: I04c78d86faa283e135dbcb86dac0cabd7b6a0724
2020-10-16 12:28:49 +03:00
Andras Timar 34bc966d68 change product name
Change-Id: Ic34d324c952364442d3f4f9f0758676ab57c8a9a
2020-10-02 14:18:28 +02:00
Pranam Lashkari 22359767d6 tdf#129296 leaflet: Password protected document load failing
Do not send faileddocloading error if it is because of password.

When the document is password protected, we send to the client
both passwordrequired and faileddocloading.
These two are handled differently. While the first prompts the
user for password input, the second internally flags fatal error
and shows an error message that the document may be corrupted etc.
The end result is that the document is not loaded and displayed
when the user submits a correct password. To reset the fatal
error one has to reload, which is unhelpful when we need to
provide a password.

This patch makes sure that we only send one error message to
the client. If a password is required, it already implies that
the document didn't load, and that with the proper password we
should try again.
Similarly for when the password given is wrong. However, if
loading fails and it isn't a password-related failure,
faileddocloading error is returned and in this case the client
handles it as a final error (that requires reloading to retry).

Change-Id: I383418fd40b6e0749b20af0ef8dc40f391a05559
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98676
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-07-16 19:31:31 +02:00
gokaysatir ac682772a6 tdf#114982 - AdminConsole: control logging
Change-Id: I53cf4b0ff81ea9d6bf4ad595077f7365e7e34c00
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94130
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-30 11:10:19 +02:00
Marco Cecchetti 255d24ba8f forward the device form factor of the client on a new view request
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>
2020-04-29 13:18:49 +02:00
Andras Timar 33000dfded typo fixes in comments and code
Change-Id: I6f31e050aab701e31064e1abc9429dce0a50c279
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92953
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-04-26 23:19:52 +02:00
gokaysatir 9e0594ee2d add pretty name - Android patch
Change-Id: If0de49884954cde26bfbe8ba1dce8844af5b30bf
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91831
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-11 13:43:31 +02:00
Tor Lillqvist 07a3dcf651 Mention that parameters in some messages are actually positional
Change-Id: Ifeb09f96ab43784d428f6ad1cbcdbfc27e6595c9
2020-04-03 14:54:35 +03:00