Commit graph

2642 commits

Author SHA1 Message Date
Paris Oplopoios
baaecac852 Add debug option that allows tile dumping
Added a debug option (triggerable using the about debug menu) that
allows you to dump tiles as they come in

Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: If5939b816c1e3598e50c2db4971710524f855909
2023-06-05 08:59:39 +01:00
Julius Härtl
752cde163e feat: Add UITheme option for light/dark to ui_defaults
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Change-Id: Ief028dcec0daa2ae448f83df993e0e5ade594a7c
2023-06-01 09:49:08 +02:00
Marco Cecchetti
b9f9cef60a a11y: populating editable area with focused paragraph
We handle notification from core about currently focused paragraph:
content, caret position, text selection start/end.
Notifications are sent on any text changes, even when the text has
been modified in another view.
Moreover we can request such info to core at any time.
That allows AT software to read focused paragraph and selected text.
All that keeping editing still working.
A set of new cypress tests for checking clipboard content has been
developed.

failing cpp unit test:
- HTTPWSTest::testInactiveClient
'unexpected message' assertion was failing since an idle client can
receive an a11yfocuschanged message when the same paragraph has focus
in both view and the active view is editing the paragraph.

failing cypress tests:
desktop
- calc/autofilter_spec.js
  - added more wait time before performing clickOnFirstCell
- impress/undo_redo_spec.js
  - Repair Document was broken
    - we need to select 'Hello world' in order to overwrite it

mobile
- impress/spellchecking_spec.js
  - Apply suggestion
    - better use selectTextOfShape instead of Ctrl-A

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I070d390543fa66fe786c4a0661fa09f891b9883e
2023-05-31 22:43:51 +02:00
Ashod Nakashian
cec4cf087a wsd: test: initialize logs before unit-tests
Make sure that the logging subsystem is
already initialized before starting
unit-tests.

Change-Id: I2ce3ffdb2d3b0094ae7ed496d7cacfc02af89c21
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-31 07:40:11 -04:00
Szymon Kłos
fad3441650 linking-api: always response for thumbnail render requests #6416
followup for:
commit 012b00d
linking-api: always response for thumbnail render requests #6229

in calc and impress we don't get cursor message when switching to
target (slide, range), so don't check if target was reached,
statechanged messages are good enough signal we are loaded already

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I63aa5aefeef153d4d6e2b483e1cdb7bf2c6268ac
2023-05-25 09:14:58 +02:00
Andras Timar
bd119af2bb iOS: build fix
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Idc47510f5b6c28f27b3cfac476e7a648dad03fb5
2023-05-25 09:13:32 +02:00
Pranam Lashkari
1f2367f563 wsd: const parameters
follow up for 25efeea0d8
missing const in modified function caused build error

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ic0f4ae39476e16a9a49904e06b44f26d2a5d4fe7
2023-05-24 15:20:17 +07:00
Ashod Nakashian
004d0c66b2 wsd: simplified initialization of WOPIFileInfo
Reduced duplication.

Change-Id: I2b97d84a0c132c02a833bfbf78957d8f9765129d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
08908a6a0e wsd: WOPIFileInfo inherits FileInfo
Change-Id: I2a40e0b6c7d260c6377b13250cd13681156b5ff1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
7af95798df wsd: cleaner modification of private members
Now StorageBase::getFileInfo() is strictly
used for reading.

Change-Id: I0d412e7ef6e502ae8b1864131b6f174e44343273
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
804bfa2e4e wsd: move PostMessageOrigin into WOPIFileInfo
This moves the logic to update the PostMessageOrigin
field in WOPIFileInfo to be done in the constructor.
And now getPostMessageOrigin() returns a const&.

Change-Id: I88936441edb58deb65d901db4baaf6311be3bdd1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
6d2f3605b3 wsd: const parameters for WOPIFileInfo ctor
Change-Id: I9a742d988f3a2817e2f56a0012df38b71a6e0d4e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
9e798e9c12 wsd: wopifileinfo -> wopiFileInfo
For consistency.

Change-Id: Ia30b4e3c95e25691bb32d5007729a22f1eb05344
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
c62e39a27d wsd: cleanup findJSONValue
Remove unused bRemove parameter.
Use Util::toLower.

Change-Id: I9991090a42231f614a5c3762e225b58ef341aac3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
68200eccff wsd: WOPIFileInfo needs not the call duration
The call duration is already logged elsewhere.
No need to pass it around and log again.

Change-Id: Icef50b9a8a48dcecc78a6b99c6311fc0d5b2a676
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
25efeea0d8 wsd: const parameters
Change-Id: Idff04bde8f67905309fffb62eaef351730c3e2e1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
155bc06e24 wsd: de-duplicate assertCorrectThread
This merges multiple implementations of
assertCorrectThread and simplifies its
usage.

Change-Id: I7be5dea62c6046fb0412d7f885fcbcc4b66e3fd9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
0aefa70347 wsd: merge StorageBase::validate with ::create
Change-Id: I55ce50301cdf9ed415d30da1fb030abc0e8dfdcb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
6530834155 wsd: make URI validation independent of Storage creation
Change-Id: Id8213d23d04fc717683361397d511cbd8300136d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
9d07402bea killpoco: reuse URI encoding
Change-Id: If9bb48973c61ba56860aac273534fa4db67c9e6f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
ddefe7a3bd wsd: logging
Change-Id: I0aa2345891c29bd97cd43cfcd2c5ecf0e4cfd2c4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
47f5d86dc4 wsd: simplify uploadToStorage calls
Change-Id: I5ed3ce09dae8b6176d806d0bb5994e56c182ac8b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
9bc4b5c500 wsd: whitespace formatting
Change-Id: Id50baf8d1c539d047ba8142bfab93b445187d658
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Szymon Kłos
012b00d6d4 linking-api: always response for thumbnail render requests #6229
when we request target which doesn't exist or it is the first
character in the document, we receive only one cursor invalidation

in that case we didn't respond at all for the request because we
were waiting

this patch added fallback, so when we receve statechanged messages
we know we already loaded document so we don't need to wait more

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ib25ab4f4d68809e3ef97ccb826ba44aeee2f71dc
2023-05-17 16:43:54 +02:00
Andras Timar
a34870d402 Add possibility to define product name from brand package
This is the product name served by hosting/capabilities
endpoint. Also, it is used by update checker.
It can be defined --with-app-name build time, but if
we would like to configure it run-time (e.g. with the
brand package), then we need a config setting for it.
E.g. brand package could execute
  coolconfig set product_name "foo bar"
in postinstall script, if necessary.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I8e72d3a3735e3a77c7aaac9a88b2c0fc6a957c0e
2023-05-17 12:53:11 +02:00
Andras Timar
a71f59c9cc Add possibility to define help root URL from brand package
Previously the help root URL was defined in coolkitconfig.xcu,
but it was inconvenient to change. Now we have this setting in
coolwsd.xml, therefore it can be changed more easily. For
example a brand package can disable the Help buttons on
dialogs by executing the following command in postinstall
script:
  coolconfig set help_url ""

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I6d0bdd71ca908df3d2dd20bd321aff9e93896f52
2023-05-17 08:26:38 +02:00
Ashod Nakashian
9410189280 wsd: better detection of modification during a conflict
When we detect document change in storage, we have to
either prompt the user(s) to either reload from storage,
discarding their own changes, or force saving their
changes and clobber the version in storage.

However this implies that the loaded document was
modified. Because otherwise, we do reload the
document from storage, automatically.
This change improves the detection logic to take
into account not just the saved state of the
document, but also the upload state. That is,
if a previous modification was not uploaded yet,
then the user does have changes that they need to
consider to discard or save.

Change-Id: I5f03593bebc5b565fc19e78562896bcdcb6112e2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-16 16:55:40 +01:00
Patrick Luby
aad344f8a5 Suppress or fix all iOS compiler warnings without changing any code
Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: I3a7693ad1d4a7b4873e462a26a9628454884c8c2
2023-05-16 09:43:29 +02:00
Ashod Nakashian
337c98a0b6 wsd: improve rename action handling
This corrects the ending of renaming by
moving that logic only after we get the
async upload results (either success,
failure, or timeout).

It also cleans up a few cases, such as
not needing to special case renaming with
identical names. This ensures that
subsequent attempts are not ignored.

Change-Id: Ib7a432d8a3b6ef5448291763cd31cc844c997e7e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 15:29:50 -04:00
Ashod Nakashian
df89ec90ae wsd: http: killpoco in prisoner http handler
Change-Id: I82f030d1d91afa504a095b852dcdaec9d2df386d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 15:25:58 -04:00
Ashod Nakashian
dc1d0a2f3f wsd: quarantine: refactor the timestamp
Change-Id: I6abde4e8e179004decdb7e631fea4a45fdd2a592
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
87fcb6f692 wsd: quarantine: correctly sort files based on timestamp
Change-Id: I65b9dfcbb9d3969fd9b0b2374ded4851bef22b74
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
c82cf3cc45 wsd: quarantine: thread-safe quarantining
The QuarantineMap is shared between DocBroker
instances, which makes it subject to concurrent
access and modification. As such, it must be
protected via a lock.

Change-Id: Id62587b33123748f848110a5427da3e296725de9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
8f1354dc91 wsd: quarantine: size calculation
Change-Id: I97d87afd7b5769c76c0112faa4fa90449a1940d4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
a9562dc3f2 wsd: quarantine: better filename tokenization
Change-Id: I0ddac3ba63cc1aa1bd8dfffd7ccb3a50013f8bd4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
eaf69c8b19 wsd: quarantine: simplify the filename
Change-Id: I83e0fb9da054063af822541805bfe92d460affbd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
203cc2f97f wsd: quarantine: delayed construction of the quarantine instance
Since we need both the PID of the kit process and
the document name, it's easier to construct the
quarantine instance only when we have downloaded
the document.

Change-Id: I8b537122c4b10ae6e822a82fa6a75456d0eaaaff
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
49ecd63837 wsd: quarantine: cleanup and logging of quarantine file removal
Change-Id: Idec703875448e30fdab99a6e96264a9b1a5cdc4e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
28eb354bd1 wsd: quarantine: better quarantined version cleanup
Faster algorithm and logging.

Change-Id: I96b2e9486ee1d988f4b4b038bf6ecdcb5a816647
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
5dc587f7fa wsd: quarantine: improved cleanup
We now use the timestamp in the quarantined
file, not the modified time on disk. Since
we have the timestamp, we should use it.

Change-Id: Iaf4a9cab2203da3e3842d7fe46b4578a031f0958
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
668bfbfb35 wsd: quarantine: docKey is already encoded
No need to encode/decode docKey,
since it is always encoded already.

Change-Id: Icd9c6d24ca57e9f0ffb06efc7052df175d5d383d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
10553c4a78 wsd: remove unused helper
Change-Id: Ib27e596d751c78e40a51a53ece5c523ab6e7eabf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
3feb547bae killpoco: remove direct URI encode/decode usage in RequestDetails
Change-Id: I27e616300c8defd115be894ecf56fe72916748cc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
6ed935bf89 wsd: quarantine: encapsulate QuarantineMap
Change-Id: I8b4da2cb4c2291c70f6a0d513a72f47899428e3e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
81b452b225 wsd: quarantine: include correction
config.h should only be included in .cpp files,
never in headers. The reason is to avoid having
it accidentally included, which would also
allow for it being effective only in subsequent
code, not those included earlier.

To avoid these problems, each .cpp includes
config.h at the top, so the configuration
directives would be effective throughout
the translation unit.

Change-Id: Idae87e5ee51abe454cc2a53d6f60dc07f64d0c35
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
b81db549dd wsd: quarantine: capture the maximum quarantined file versions
Change-Id: Ie2756580954ed759e250340b786ae602d213b321
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
8fa978139f wsd: quarantine: capture the maximum age of quarantined files
Change-Id: I36f681ec5672d77e15ef6a9104d1b3ad874b189d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
99baf40e7e wsd: quarantine: capture the maximum quarantine size
Change-Id: If30f0b7349e6605708e2bd5821b6e25558fba104
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
799b704e32 wsd: quarantine: capture DocKey
Change-Id: Ic22ac58210bad27d9a02d589828151548c4a1bd0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
6ab3bbbd09 wsd: quarantine: capture the document name
Change-Id: Id308a80e2d504d82e021e7333b78488dabbac687
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
08967941a3 wsd: quarantine: capture const values
Change-Id: I67233c8d5bbd0cf63133e6643dd0106c4c3bcae6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
0c0d7071ab wsd: quarantine: minimize explicit arg passing
Change-Id: I7b18abc96ccf0a217a806cf2259c539964bad553
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
0ccc182509 wsd: quarantine: provide the filename to quarantine
Utility classes/functions should not re-implement
any logic external to their function. The
path to the file to be quarantined is controlled
by other bits and QuarantineUtil is simply told
to quarantine the given file.

Change-Id: Iab351ccbf78953bb63f18c451321d34fe61f59b5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
3825205042 wsd: quarantine: more encapsulation
Change-Id: Ifed497ad246fa9fb4a3d349aa579ce6e88793066
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
7ea3495f22 wsd: quarantine: convert Quarantine to a class
Change-Id: I9478f35e6c7c3f156aa15072e31c38bc84dc2b64
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
d81f2d71ed wsd: quarantine: smarter quarantine enabling
There is no good reason to check the config
repeatedly, especially that once we initialize
we should have the state.

Also, we should be able to disable quarantining
when we hit an error during initialization.
(As an aside, reading the config is slow and
throws exceptions that are caught internally,
which makes debugging for exceptions frustrating
when we repeatedly read config entries.)

Change-Id: I44a7800df96a370ef4d4cc1d6bb171f60f1499a0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
3c5a6963fe wsd: quarantine: encapsulate the quarantine path
Change-Id: I738a06b3a272a049ef8772fa0502a7f2de03c881
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
bd4589d142 wsd: quarantine: cleanup quarantined files when unloading cleanly
Change-Id: I1934bca783f94847c73e9c47d0e8c703dbe75a99
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
c658d0fb90 wsd: more accurate comment
Change-Id: I553c9b302e243cee15ab66e041a6fafe4adf41b8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Jaume Pujantell
cfe1fd955f enable export to pdf for readonly documents
Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: Ibcd149d51b20df552a0961c58b7c9159fbf0af9e
2023-05-14 14:43:07 +02:00
Ashod Nakashian
d4b27f6643 killpoco: replace HTTP status codes
We use our own status codes, which
are type-safe and use streaming
operators to serialize and log.

Change-Id: I0eba7b16694866b5a79476a7ef4b1b78f7f9c176
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-11 07:21:42 -04:00
Ashod Nakashian
171a3614d7 wsd: use helper where available
Change-Id: If5d1abdc4da6218e318a72d06eb2483c4348d349
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Ashod Nakashian
4456acd2da wsd: make unreusable classes final
Change-Id: Ieea44cdba1315051ede7dde6e154055a0820b0a8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Ashod Nakashian
6d4bb52946 wsd: minor logging cleanup
Change-Id: I1ea4f224ef2e0caee1a849abd5256521afe939bd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Ashod Nakashian
0182af7a4a wsd: http: native support for logging http::Header
Change-Id: I8c34531e6f2616d98a4ee75fe8490d4ad25c45a9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Ashod Nakashian
ff1657934a wsd: simplify log streaming
Change-Id: Id22de0bc06680f957e7475f142bcaf1131fdbdb9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04: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
f7af990485 admin: added a seprate state for the uploaded document
- previously we set the Modified state in admin panel only when
  wsd successfully upload the document to storage
- modified state updation depends on core, it might happen that
  uploading is already done and successfull but we didnot get
  the modified state from the core which will show wrong modified
  status in admin panel

Change-Id: I014a8f92753fc6a93b37921d0f3cdce390bef35e
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
2023-05-04 11:35:07 +05:30
Ashod Nakashian
0f5e2c6570 wsd: track the storage attributes more accurately
We now track the storage attributes in three
distinct states. The first, when we issue an
uno:Save (called nextStorageAttrs), when we
get the save response (called
currentStorageAttrs), and when we upload
(called lastStorageAttrs).

What this does is allow us to separate the
attributes without clobbering them, while
supporting retrying when a failure accures.
Specifically, we shouldn't lose the
attributes of the latest save when the async
upload completes. Similarly, we should
preserve the last upload attributes when
the upload fails.

This approach improves reliability
significantly, as evidenced through the
new test, UnitSuperfluousSaves.

Capture the current storage attributes upon saving

Change-Id: I91756fda7b9ed5887dc4ed9691db536371b5bcad
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-28 06:58:58 -04:00
Ashod Nakashian
8bbf5e62d0 wsd: process the modified state from uno:Save
A new field, called wasModified, is now published
in the uno:Save result. This gives us an accurate
state of the saved document, whether it had
user-modifications, or was an unconditional forced
save by the user.

Using this flag makes the IsUserModified header,
used during the storage PutFile request, much
more reliable.

Change-Id: I0b7e4421d4a42eef01e19be8d9ee0bee6bff9f03
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-28 06:58:58 -04:00
Ashod Nakashian
6dd3feeea7 wsd: do not allow multiple saves in flight
It's easy to use keyboard shortcuts to issue
multiple saves within a short period of time,
which is hardly useful to make saves faster.
In fact, they'd make the server and document
slower by adding overhead.

Similarly, we could get autosave requests
on certain occassions (for example when
the last editor disconnects) while saving.
Again, there is no advantage in issuing
another save in that case. We re-evaluate
the save state when we get the save result.

Here we prevent issuing another save while
one is already in flight, regardless of the
reason.

Change-Id: I9503adabc3a9f1dc6cdbbcf93c5cccbc5414fcf3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-28 06:58:58 -04:00
Henry Castro
0db06a8679 wsd: include CSP server host to ...
load using script interfaces.

There is use case such reverse proxy uses another domain
to request the l10n json resources, but the CSP Chrome triggers:

l10n.js:62 Refused to connect to 'http://192.168.0.2/localizations.json' because it violates the following Content Security Policy directive: "connect-src 'self' ws://192.168.0.1:9980".

request_JSON @ l10n.js:62
String_ctr.<computed> @ l10n.js:85
(anonymous) @ l10n.js:263
(anonymous) @ l10n.js:286
l10n.js:62 Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://192.168.0.2/localizations.json'.

Change-Id: I57fff24c00adebdf7dd06929d6341ea14554a6d2
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-04-28 06:30:57 -04:00
Michael Meeks
f6bd976f00 Jail cleanup - include coolwsd pid + hash into a jails sub-directory.
This avoids removing the jails of other running coolwsd that share
the same jails/ directory, such as unit-tests, cypress tests etc.

Assert on fatal system error to help catch this during test builds.

Remove old unit-test specific approach, and generalize it, since
apparently we did a recursive cleanup of other people's jails anyway.

Remove over-complicated recursive approach, for a rather simpler
one-level scheme. Avoid following symlinks too for safety.

Remove obsolete lo_jail_subpath setting.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I371f8c0e22f64fb2befb4b58f72cefa39567f3b5
2023-04-25 10:41:57 +01:00
Tor Lillqvist
bc6b3bbaee Fix build for iOS (and possibly for Android)
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I5eb5187b896b7e80aaab5660a8f10268b565dc8f
2023-04-24 17:15:47 +03:00
Szymon Kłos
29d46f5358 Parse theme correctly
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ib54cd5a3761666f48f9a7d0b73194206db27e199
2023-04-24 14:04:43 +02:00
Szymon Kłos
83e2b3375d Format correctly url variable
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I03be69eee26a8b2e8ca1e57a142602671688b86f
2023-04-24 14:04:43 +02:00
Andras Timar
1540676bae Let's keep HTTP server error messages as plain text to avoid complications
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I16510476b3ec00c6ce3da6ae38beef48ad8f06e3
2023-04-24 14:04:43 +02:00
Michael Meeks
93b41527e3 Cypress: accelerate tests by not re-downloading & JITting JS.
add forcecaching parameter to coolwsd for debug mode.

Change-Id: I6f38e9a4fd6dbb76e92105c76e8abe3e75f19ef5
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-04-15 11:45:22 -04:00
Ashod Nakashian
8facb429c2 wsd: make removeSockets private
Change-Id: I7171c67bbbe4682cf10e015e600fb25f03d4e5bb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-14 18:02:14 +01:00
Ashod Nakashian
1df26c35db wsd: do not use expired token to lock storage
Change-Id: I733bcb53c50faa2f410af2f10f4c225797f49ecb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-14 11:30:14 +01:00
Ashod Nakashian
55c9280e02 wsd: multiple writes to stderr may interleave
Particularly annoying with trace level logs
when they trample over one another.

Change-Id: Ib1a8f8b8117364886af5043120e65ec7cb12e12a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-14 11:30:14 +01:00
Ashod Nakashian
9dd0636bcd wsd: announce the debug URLs to the user after server runs
The port used for client connections does change when
we cannot connect on the default/first one. There is
no point in announcing the default when we don't
yet know the actual port, and similarly it's not
helpful to do so before the server is even started.

We also move the remote-font-config thread to an
earlier point and merge it with another #if !MOBILEAPP.

Change-Id: Icc28817c7a03d49a7e130b076e545fe3ce2fb81a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-14 11:30:14 +01:00
Jaume Pujantell
518acd1127 Disable Change Password button for users who don't own the document
Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I2e1fc1e5b6e50cd7ec5ad9d78db36e76ce6426c9
2023-04-12 14:33:07 +02:00
Ashod Nakashian
3dbfce54d3 wsd: helper to dump the state of an object as a string
Change-Id: Ib49a47be2dc37663ef06ac80be981c9f3c029814
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-11 08:03:01 -04:00
Ashod Nakashian
335843f527 wsd: remove unused DocumentBroker::getDeferredLock
Change-Id: I0660b8074227408cb2f9a4009d3de15aac2c11ef
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-11 08:03:01 -04:00
Ashod Nakashian
e960e52636 wsd: remove unused Force flag from enums
Change-Id: I752842f56ab4520a624848b6be2724775189ea51
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-11 08:03:01 -04:00
Ashod Nakashian
8b2d230c64 wsd: logging and cosmetics
Change-Id: I2c7a2c22e073bebf66d542d5e81b1496b8057319
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-11 08:03:01 -04:00
Ashod Nakashian
158e1a125f wsd: avoid using the default port for unit-tests
Change-Id: I4d8681491b0aeedbc349c7644551f51052adf63d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-11 08:03:01 -04:00
Ashod Nakashian
aace69c087 wsd: check for editable session not readonly
The following commit caused a regression with
PDFs which are read-only, but may allow comments.

commit cca0a561ed
Author: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Date:   Sun Jan 15 18:29:18 2023 -0500

    wsd: never upload using a session that is read-only

Change-Id: I9bf1fde21b47a4f119b99cc58f76cd683c2152a9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-24 13:54:35 +01:00
Michael Meeks
7ba6c10e6d valgrind / massif - improve things a little.
Avoid SIGKILL'ing children when valgrinding to allow time to save
massif traces etc.

Change-Id: I255a62b6605164ac5037a06455f1adfcba05759c
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-03-23 11:31:24 +00:00
Szymon Kłos
47cd213b10 export as pdf: we need to decode path
When using Nextcloud with source file with spaces in the name
eg. "file name.docx" and we tried to export as PDF
then error appeared.

In the logs we had "SaveAs produced no output in '<...>file%20name.docx', producing blank url.

We need to decode file name similar to convert-to case.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ic60cefefc4e20b53feee28b86443090c147bb66e
2023-03-21 07:39:15 +01:00
Paris Oplopoios
ab176b13a8 Move canonicalId creation to the Kit
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I943bfa0436487e517b25d3fce19157ebd576604f
2023-03-17 17:34:05 +00:00
Paris Oplopoios
d26c425dae Move _canonicalViewId out of Session
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
Change-Id: I9c06440ed47eb217e973d2f530f2c3646d55d85b
2023-03-17 17:34:05 +00:00
Patrick Luby
7dd1e505e6 Fix issue #5841 welcome, feedback, and buy product URLs are empty on mobile
Mobile apps don't substitute these values so set them to zero length
strings.

Also, the iOS app sets the base text direction via the "dir" parameter
so add handling of that parameter in cool.html. TODO: check if the
Android and GTK apps need to implement the "dir" parameter to handle
RTL layout.

Signed-off-by: Patrick Luby <patrick.luby@collabora.com>
Change-Id: Ied8268ec256011281961ef610d53baeee0efe9cd
2023-03-15 09:29:56 +01:00
Patrick Luby
17f739ca77 Fix issue #5887 by assuming that documents are writable on iOS
The iOS app saves directly to local disk so, other than for
"view file extension" document types or other cases that
I am missing, we can assume the document is writable until
a write failure occurs.

Signed-off-by: Patrick Luby <patrick.luby@collabora.com>
Change-Id: Iacb1589eded18f0cb21a5dd8e4d91d295ae697fe
2023-03-15 09:29:56 +01:00
Ashod Nakashian
f91a7dd772 wsd: reduce minimum time between requests
Previously we waited at least as long as
it took to process the last request before
issuing a new one. This can be unnecessarily
long, especially when unloading. Now we half
that time.

We should consider a more sophisticated logic,
especially during unloading, where it's best
to upload quickly.

Change-Id: Id903b8a064bd8431578221dc9386ab08d46dd2dd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-14 20:40:40 +01:00
Ashod Nakashian
a941de6fb7 wsd: mark last upload request time
This corrects the reported upload duration
at the end of uploading.

Change-Id: I9d3af4d3dce5aff0c3526ba009fc0b27150bc070
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-14 20:40:40 +01:00
Ashod Nakashian
9caa1f9a18 wsd: pass by reference where possible
Change-Id: Ib5501d6b766b982f34b226a20128c89f0ae7d84e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-14 20:40:40 +01:00
Ashod Nakashian
e6180f31f3 wsd: remove single-use getWriteableSessionId
Change-Id: I66a77be784aaef61472cd02cb49168813d75548c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-14 20:40:40 +01:00
Ashod Nakashian
43515fcbbf wsd: correct config default-value name for rotateOnOpen
'rotationOnOpen' -> 'rotateOnOpen'.

Change-Id: I204e1f1208cbc8089a10472fc52b4c2e83e3eaf5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-14 20:40:40 +01:00