Commit graph

2694 commits

Author SHA1 Message Date
Rash419
855429dad5 admin: send serverId with migrate msg
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I484620df234a1dcbedeba5b5102dacee7451015a
2023-09-07 18:35:32 +05:30
Paris Oplopoios
0621aa4825 Fix canonical id related unit tests
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: Ie4b965c3bac8cddd48a47343d2d1c5f387d8bd41
2023-09-06 10:28:26 +02:00
Paris Oplopoios
5409175a2a Add assertions for bad canonicalviewid
Change-Id: I2621e08123ca9cac30e027b0c018c0e9cc40750d
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
2023-09-06 10:28:26 +02:00
Ashod Nakashian
e6798e9062 wsd: exclude readonly sessions from modification indication
Read only sessions cannot modify the document, so
we shouldn't consider input from such a session
as potentially modifying the document. This
becomes important during an abrupt disconnection
where we look at isPossiblyModified() as an
indicator for data-loss.

New unit-test that reproduces the corner-case
with disconnection. With graceful unloading
a previous unit-test verified that it worked
as expected.

Change-Id: Id84cda4f4599c559018247c32ea1205e154e4984
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-01 07:18:12 -04:00
Miklos Vajna
9b3139d65a wsd: fix -Werror,-Wimplicit-const-int-float-conversion
wsd/ClientSession.cpp:520:32: error: implicit conversion from 'uint64_t' (aka 'unsigned long') to 'double' changes value from 18446744073709551 to 18446744073709552 [-Werror,-Wimplicit-const-int-float-conversion]
                    (counter < (uint64_t)(std::numeric_limits<uint64_t>::max() / 1000)))
                             ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Which is a problem since commit e0b70657fa
(cid#318912 Result is not floating-point, 2023-08-23).

Let's make the conversion explicit, hoping that makes both Coverity and
clang happy at the same time. No change in actual behavior intended.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ib9727f0df4df65a9504d421654d519bee0733b80
2023-08-30 09:25:27 +01:00
Rash419
3ce8c1b224 feature_lock: fix unlock_image option not working
- regression from ec17f72fb5
- also removed the restriction to have "static" in unlock_image
  url

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ie4f1170fb6a12db5218fb28f21d78f88ebc61d56
2023-08-28 16:12:41 +05:30
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
afe6c1bed8 reduce cost of TileDesc::parse
perf reported 6.58% of time in collaborative multi user test
on 2023-08-24 was spent in TileDesc::parse and much of that
in std::unordered_map.

There are only 12 arguments in the map we care about here so
we can just used a sorted array, look by name on write, and
read by index.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iadfc2001e298d8f4d46200c8488f0eb4cd8734c2
2023-08-24 22:22:43 +01:00
Caolán McNamara
e0b70657fa cid#318912 Result is not floating-point
we presumably want the current behaviour so silence with
an appropiate explicit cast

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibed4cb2cc31b26195e407f25f7f0a2ea7172c67d
2023-08-24 08:30:40 +02:00
Caolán McNamara
26934061b1 cid#318872 Improper use of negative value
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia76b677d466c67fc47760fdcb41459446c4c8e8e
2023-08-23 12:06:31 +02:00
Caolán McNamara
7163b2f9d7 cid#318896 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1d34ae9287e3c639255541584e3daf9209387bc5
2023-08-23 12:06:31 +02:00
Caolán McNamara
6d5c78dec0 move "combined" bit inside TileCombined class
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I274c5844660acbf69e50587cce3f4ddcae414723
2023-08-21 20:48:31 +01:00
Rash419
c9e7591add clusteroverview: send routeToken with auth message
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I6412d68ef0c86d7a618eaf0ad252c16dee565d77
2023-08-18 23:27:04 +05:30
Caolán McNamara
42df0dac71 cid#318842 silence Unchecked return value
and

cid#318906 Unchecked return value

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9033f43dbbbcae8f5a15980d6f7b844370d54c7f
2023-08-15 15:09:36 +02:00
Caolán McNamara
ce0c11f09f cid#318866 can elide the temporary here
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8a7bb1b6b8535ecbdae8deddc10f3c010db28897
2023-08-15 15:09:36 +02:00
Caolán McNamara
eaa2b0cf2f cid#318821 COPY_INSTEAD_OF_MOVE
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I91e2fe0bcbf9ebe68917b0326425ac73bfa544fe
2023-08-15 15:09:36 +02:00
Miklos Vajna
7d6619be90 wsd, coding style: document double review for security
Document that authentication changes need double amount of care,
compared to other normal functional changes.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ib1820581f7175957f08f5e080d542c7441a3ffa2
2023-08-15 08:20:05 +02:00
Ashod Nakashian
efe874f89c wsd: simplify shutdown and termination flagging
With the use of a single flag for both, the
logic is now less ambiguous, as we cannot have
termination flagged without also implying
shutting down.
The assertions are no longer needed.

Now that setting the termination flag
explicitly implies having the shut down flag
as well, the checks are simpler. We only
need to check that the shutdown is not set
to continue running as normal, since having
the termination flag must perfoce mean shut
down is also set, there is no need to check
both.

Change-Id: I99e22f5668385182b0594040a8e3354b55e74642
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-14 16:32:50 +02:00
Caolán McNamara
307818ba1c cid#318834 Missing move assignment operator
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I798c0e6610afca9d0d503514b33e75c35a7ccb33
2023-08-14 12:31:55 +02:00
Ashod Nakashian
a42adac98f wsd: add the web-server URL to the media-src list
We need to allow loading media sources from
the web-server URL. This seems to be necessary
at least on iOS.

Change-Id: Ic7b23c4f80b975460de9311a67f3c5cb51758d14
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-10 12:24:08 +02:00
Caolán McNamara
1cd88f217e cid#321976 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2207cc530e1773f29cf540ea2ff9c6f44c4c237b
2023-08-10 08:47:25 +02:00
Caolán McNamara
6d873d6837 cid#318919 Dereference after null check
map is never null so make it a reference

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9f6ad863d0a1102dd7e26a5668b1c6ba71249580
2023-08-09 13:39:23 +02:00
Caolán McNamara
2119a19881 cid#321981 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6c2d30c8db254beb6b20aae7891b089a986a4df8
2023-08-09 13:39:23 +02:00
Henry Castro
a2b924033d admin: rename ACCESS_TOKEN -> JWT_TOKEN
To avoid confusion with the WOPI access token.
.

Change-Id: Ie38e0f11d0655e89eb1c7f1e20b73a9b8756ba21
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-08-08 08:27:30 -04:00
Rash419
0ed983d7a3 admin: refactor adminClusterOverview.js
- refactored special case for templating
  adminClusterOverview.html
- removed useless variable
- format the code, fix indent

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ib22cb481db7c7ef94b11f3044d0cd856e6d0eed5
2023-08-05 14:28:29 +05:30
Rash419
944f269926 admin: added new cluster overview page
- added DlgLoading class to show loading modal dialog
- upgraded the d3

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8bd99bbadaa59a7de1e83bebde8db0dce920705d
2023-08-05 14:28:29 +05:30
Rash419
fc77e1a1ff admin: fix auth issue when switching between
multiple cool servers
- also good to check response first as client
  might use persisted cookies

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Idcd85266a4cc5020aeaca7d7fb8428bc0a3d7d32
2023-08-04 21:25:37 +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
Caolán McNamara
509c29421e split this hunk into reusable ClientSession::onTileProcessed
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I383542b6c9c3a888937e2f7e330ec7e77efaaa82
2023-08-04 13:07:29 +01:00
Caolán McNamara
8bb41ee775 cid#318947 Unchecked return value from library
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia8b96035d5038d82a55f68a751fdbda5806ec1d6
2023-08-04 10:17:58 +02:00
Caolán McNamara
1d179cdf76 cid#321981 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I92d66a3d497d574d819f18960bff5b60e180b715
2023-08-04 10:17:58 +02:00
Caolán McNamara
7cb1dfd4eb cid#321977 AUTO_CAUSES_COPY
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I50f94b290e40b11d555c51448630835d71a62019
2023-08-04 10:17:58 +02:00
Ashod Nakashian
75ae9894b9 wsd: Util::make_unique -> std::make_unique
Change-Id: I1063913f91571ea6ad95386a3da6a4072574d155
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Ashod Nakashian
5b52f7d8eb wsd: smart pointer cleanup
std::make_shared and std::make_unique
are superior to explict smart pointer
construction. Where we have private
constructors, we can't use them.

Change-Id: I492122f58e958113c6e6d31445c6614ad98c89aa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Ashod Nakashian
b8854ea2e9 wsd: decouple FileServerRequestHandler from COOLWSD
Change-Id: Ie121849a16bb84195d32e11a67e4aad5753aebfc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Ashod Nakashian
d47001267b wsd: reduce manual http header creation
We have http::Response specifically for
this kind of thing.

Change-Id: I57130754f95c06f5ab958ca373f21763e74cb6a2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Ashod Nakashian
c1725faac1 wsd: dump the last quarantined version with the status
Change-Id: I46e1d84ba46bea3bf6cfd9c043af247e8b37afc1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Henry Castro
47485adc3e admin: add access token
The access token will validate the session
when a websocket is connected to the server.

Change-Id: I008b04a499ab0d85fd6f95fc06a511f800c0bb2e
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-08-02 20:23:42 +01:00
Michael Meeks
03d83ab6b8 paste: cleanup excessive debugging.
We don't want to dump the whole paste buffer as hex, or indeed any
large mis-encoded string - instead crop to the problematic section
for easier debugging, and no performance hit.

Change-Id: I30518beea436895a42b3429c3cb6e16e2093cca9
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-28 21:38:02 +01:00
Pranam Lashkari
fb5909bc40 theme: use integration theme value from the interation message
problem:
till now we used values from DOM elements which were unreliable,
sometimes they are not discoverable due to nested iframs.
That threw some 404 due to incorrect theming path.

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ibc291ce9f64db799095e1edcb14c598bdd085de7
2023-07-24 10:06:35 +02:00
Andras Timar
fc946198d3 Rewrite coolwsd-generate-proof-key in C++
* simplified the tooling a bit: use coolconfig for creating
  RSA key pairs for WOPI Proof headers.
* got rid of a dependency: ssh-keygen, towards leaner docker images

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Iaf468b5c8585d45027f512bb0a287ab77afb1ea9
2023-07-22 00:14:48 +02: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
b7d7c02a3f deltas: allow JS tilecombine to force sending a keyframe to the client.
However, don't force rendering a keyframe, only sending it - other
clients may be happy with deltas. This is to better handle:

window.app.console.debug('Unusual: Delta sent - but we have no keyframe for ' + key);

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I4efff0f6b1d2817e6b8bd567eb3b098383a1ef42
2023-07-17 11:35:25 +02:00
Rash419
8c5d822dc9 android: fix: save failed error while parsing save command
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ia6a53184322f403d2b995213700193d5612fd63d
2023-07-15 20:33:18 +05:30
Szymon Kłos
3d6ed28857 Fix pasting image assertion
Revert "Avoid crash when pasting image in debug mode"
This reverts commit 78558fe9af.

Instead of detecting paste command and not trigerring assertion:
fix frame type so it will be binary in case of paste.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: If5c726463459be7eaffae1522df522dfa1d74443
2023-07-13 20:06:58 +02:00
Michael Meeks
9270ceef16 update: send for redundant tilecombine requests.
Update tests to check for this too.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I02c8f3167886321496245589b34a382fd61617f0
2023-07-13 08:14:48 +01:00
Michael Meeks
9a29a346d8 Allow tilecombine's to send oldWid information to fetch deltas.
Disable the 'forceKeyFrame' for tilecombine messages from the client,
we have a larger cache now and it makes sense to honor and track these.
forceKeyFrame was signalled with a zero oldWireId - which is the default
if we don't have it set.

Change-Id: If96423e96f8dc578a634ed5093517dfa6702cc1b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-13 08:14:48 +01:00
Ashod Nakashian
752f2a4ae1 wsd: save and upload rapidly when unloading
We normally throttle saving and uploading to
avoid hammering repeatedly, but when unloading,
we reduce said minimum wait by a factor of 10.

This allows for a quicker unload cycle, esp.
if we had just saved before unloading, or
if there was a previous failure.

Change-Id: I8710c9b86c05254ad9b9735d8496dd96900221e2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00
Ashod Nakashian
2fd159bc0c wsd: better always-save-on-exit handling
Change-Id: Id718f81fc2eb0af5ca5bfe61e687de5258dbdd7d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00