Commit graph

2305 commits

Author SHA1 Message Date
Henry Castro
abfbf4846d wsd: add remote buy product url
Change-Id: I97617ddf8c7a0fc923788477fb077f3baa16fe13
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-09-29 10:28:18 +03:00
Henry Castro
3d8cfe87fb wsd: prefix private members (RemoteJSONPoll class)
Change-Id: I19f5d01dc190d23c79a255413ad3d805b032e625
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-09-29 10:28:18 +03:00
Henry Castro
b991e6a017 wsd: add buyProductURL
Change-Id: I5ca0a84e7a927496bfe0b314967a2b11b20bd60d
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-09-29 10:28:18 +03:00
Henry Castro
6487be75e7 wsd: add optional parameter buy_product
Change-Id: I9ec71025c2ae3e0d477a8ede49dfdd96398fbbef
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-09-29 10:28:18 +03:00
Szymon Kłos
7043365475 masterpage: get & set optional mode parameter for tiles (server side)
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I756e3d515c86a635cfa9db81106848ee3dcf684a
2022-09-19 15:18:23 +02:00
Szymon Kłos
06fbc53c9d masterpage: get & set optional mode parameter for tiles
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ied50985f85db385fb38cfb9c4006e3b87119e9fc
2022-09-19 15:18:23 +02:00
Mert Tumer
c74ee86262 added option to group save-as
We can provide doctype extensions for save-as much like downloadAs
but this will load the new file in the integration. instead of downloading

To achive this, args: {format: '<extension>' } parameter needs to be
sent inside UI_SaveAs postmessage. Because the integration provides
dialog with filename, there the extension will be set after the
filename. Our save-as work flow already handles the rest.

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I6005846047fc0b26ea07e8eeea965965ed1b87e7
2022-09-19 10:56:08 +02:00
Michael Meeks
85e9d6e03b hosting end-points: accept WOPISrc parameter.
Change-Id: I902be8e0f9870b13794e1251d6fea90faffdbc97
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-09-14 10:31:22 +01:00
Ashod Nakashian
70b8bee44b wsd: reduce logging of allowed convert-to addresses
Since this is the normal and expectd case, there
is no reason to repeatedly log that the address
is an allowed one. We do warn in case of disallowing
anyway, so this isn't necessarily adding value.

Notice that this log is generated not just when
convert-to is requested, but when generating the
capabilities json as well.

Still, we trace it for easier debugging, if necessary.

Change-Id: I08661e09bc6b8eb665c6d99437631c8df45fa8b4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-09-13 09:45:43 +02:00
Ashod Nakashian
0c6413bf87 wsd: fix multi-part logging
This was a regression introduced in
14d96957cd.

The result was that multi-part logs were
not flushed and therefore not written to
the output.

Change-Id: Ib22a1da83209b00872d91ca05a940226cbb4552d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-09-13 09:45:43 +02:00
genofire
c121f5a842 fix(remote_config_pull): nullpointer if alieses not defined in host groups json
Change-Id: c94f0c69d9b31f54c755d10ac964ae8cadc5d4dc

Signed-off-by: genofire <geno+dev@fireorbit.de>
2022-09-08 19:54:32 -04:00
genofire
d2b707e838 prometheus: labels are always strings
Change-Id: 4192b04373567e5470c03a984a9e40366a8c1f4d

Signed-off-by: genofire <geno+dev@fireorbit.de>
2022-09-08 08:40:41 +01:00
Michael Meeks
29d68aa033 prometheus: don't export string values.
continue to use the pid as a short-ish label to disambiguate metrics,
but also define the pid with more labels in the 1st instance.

doc_pid{host="localhost",key="https://localhost:9980/.../hello-world.odt",filename="hello-world.odt"} 1261609
doc_views{pid=1261609} 2
doc_views_active{pid=1261609} 2
doc_is_modified{pid=1261609} 1
...

Change-Id: I573f6d5c8ceb9a7daee83d1f2ee9f42b8e0cd089
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-09-06 21:18:29 +01:00
Aron Budea
c4975d01e5 Split config.h into separate headers to avoid extensive rebuild
Eg. if only the version was changed, config.h was updated, and
everything was recompiled.

New structure, maintain these manually:
config.h.in - for configured variables that are stable if
              configuration parameters are unchanged
config_version.h.in - for version/hash related variables

----
config_unused.h.in - still generated by autoheader with all
                     variables, don't use it

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Id9a50a9f1e798a3b3814778d8683b7d7cb57bb29
2022-09-05 12:32:49 +01:00
Michael Meeks
3a1deab1d4 Prometheus - log per-document details for getMetrics.
This should perform and still be reasonably compact even
for large numbers of documents.

Change-Id: I3820af6c23806d569c23a893bd8db040dfb351e8
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-09-05 12:31:33 +01:00
Michael Meeks
ef09966978 mutex include cleanup.
Change-Id: I63d4184260d204a9d5f7658ad51fbe63dbb3c9e4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-08-31 21:31:31 +01:00
Michael Meeks
114d181845 Prometheus - clarify live document count metric.
Change-Id: If1605bddbdbf98bb4c5d204db4b7888164cc0142
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-08-31 21:31:31 +01:00
Michael Meeks
2b20e4050d Forward setclipboard data to the Kit as a binary message:
assert: invalid utf-8 - check Message::detectType()
 #3  0x00007fce7ae57fd6 in __GI___assert_fail at ./net/WebSocketHandler.hpp",
 #4  0x0000558bd2790231 in WebSocketHandler::sendFrame at ./net/WebSocketHandler.hpp:748
 #5  0x0000558bd2851202 in WebSocketHandler::sendMessage (flush=false, code=WSOpCode::Text, len=22118,
     data=0x7fce5c227b50 "child-045 setclipboard\napplication/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"\n1370\nPK\003\004\024", this=0x7fce6c003340)
     at ./net/WebSocketHandler.hpp:641
 #6  WebSocketHandler::sendTextMessage (flush=false, len=22118, ...) at ./net/WebSocketHandler.hpp:619
 #7  WebSocketHandler::sendMessage (msg="child-045 setclipboard\nappl...) at ./net/WebSocketHandler.hpp:613
 #8  WSProcess::sendTextFrame (this=0x7fce6c001300, data="child-045 setclipboard\nap...) at wsd/COOLWSD.hpp:142
 #9  0x0000558bd27d5678 in DocumentBroker::forwardToChild (this=this@entry=0x7fce64027940, viewId="045", message="setclipboard\n...) at /usr/include/c++/9/bits/shared_ptr_base.h:1020
 #10 0x0000558bd2899d50 in ClientSession::handleClipboardRequest (this=0x7fce64027dc0, type=type@entry=DocumentBroker::CLIP_REQUEST_SET, ...) at ./common/Session.hpp:76
 #11 0x0000558bd27e0999 in DocumentBroker::handleClipboardRequest (this=0x7fce64027940, type=DocumentBroker::CLIP_REQUEST_SET, ...) at /usr/include/c++/9/bits/shared_ptr_base.h:1020
 #12 0x0000558bd2847b8b in ClientRequestDispatcher::handleClipboardRequest(...) at /usr/include/c++/9/bits/shared_ptr_base.h:1020

Change-Id: I406eee0ac3a47986fdd9511e674c9228d1994d38
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-08-27 08:21:28 -04:00
Ashod Nakashian
cd497ba7f0 wsd: move storage attributes to DocBroker
There are a number of races with having Storage
track the attributes. To fix them, we move all
attributes to DocBroker and correct a number
of issues.

The idea of the design is based on the fact that
we want to capture the attributes between
uploads, but based on the saved document.

That is, when we upload a document version, we
want to pass to the storage whether from the
perspective of the *Storage* there has been
any user-modifications or not. Since saving
to disk may happen multiple times between
uploads (not least because of failures), and
since saving resets the modified flag, we need
to capture the modified flag at each save and
propagate it until we upload successfully.
Upon uploading successfully, we reset the
attributes.

For this reason we have two attribute instances;
one is the 'current' attributes as being uploaded
and the other the 'next' one. We capture the
current state at saving into 'next' and we merge
with 'current' when saving succeeds and we
aren't already uploading (otherwise, we update
it and then discard it when uploading succeeds,
losing the last attributes).

Furthermore, because the modified flag is
reset after each save, and because we might
save and upload immediately after a
modification, we may not have the modified flag.
This means that we need some heuristics to
decide if there has been user-issued
modifications. (It is better to be conservative
here.) We try to detect this by introspecting
the commands we receive from users.

In effect, we capture the attributes when issuing
an internal save, we transfer the captured
attributes only when saving succeeds and we aren't
uploading, and from then on, uploading has to
succeed to reset the 'current' attributes. In the
meantime, if we fail to upload and issue another
save, the new attributes will be captured and
merged with the 'current' and the next upload
will not have any lost attributes.

Change-Id: I8c5e75d25ac235c6232318343678bf5c0933c31e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-25 15:12:10 +01:00
Ashod Nakashian
b35625d4ca wsd: state-dumping and comments
Change-Id: I2522d1578faf28c40682f63dd487efde9c5a738d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-25 15:12:10 +01:00
Ashod Nakashian
e85854ed39 wsd: track modifying user commands
There is a race between the time of modifying
a document, receiving the modified flag, and
saving. This can happen when, for example,
the user modifies the document and closes
immediately. In that case, when uploading
we will not have the modified flag and will
not set the User-Modified attribute.

While this isn't 100% accurate, and it can
never be, it's still better to be conservative
and flag a version in storage as user-modified
than otherwise.

Change-Id: Ia504a7cddd4839bcbfeaaf9bf6c90ed8b68efa91
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-25 15:12:10 +01:00
Ashod Nakashian
cb42775e53 wsd: mark last-upload as failed in early-failure
Change-Id: Ie0726141248c605409ea52ee83ee3b17df7b1b0e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-25 15:12:10 +01:00
Ashod Nakashian
986ff2140d wsd: remove unused uploadLocalFileToStorage
Since we have moved to async uploading, this
synchronous version is not used. This removes
the interface from the base, merges the
implementation for the local-file, and removed
the error-returning one for wopi.

Change-Id: Iad2ba053bbdcd1690083dc69f66c751e7926ef41
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-25 15:12:10 +01:00
Mert Tumer
08f9b72854 DeepL translation integration
this patch relies on a core change:
https://gerrit.libreoffice.org/c/core/+/137199

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ie5f5dada18539586e7c5ea41b0a296b33ae8ee2e
2022-08-25 14:28:35 +02:00
Andras Timar
cf6e22c22c Fix typos in comments
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I813f652b516c79f350b46317e589b91e0ef39a1a
2022-08-23 18:37:44 +02:00
Miklos Vajna
3205899a31 libfuzzer: fix clientsession_fuzzer
The fuzzer case doesn't read the configuration. This is similar to
what getConfigValue() already did, now extended to
getConfigValueNonZero().

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I14a838ea9875d81413f22140eeac627520c423ab
2022-08-23 10:50:50 +02:00
Ashod Nakashian
82a5c3173d wsd: fuzzer: fix build
Change-Id: Ib52e32de04e7af230ed21eed11e0855050e97c74
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-17 08:55:12 -04:00
Miklos Vajna
c9cb1f4e01 wsd: fix uninitialized DocumentBroker::_savingTimeout
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Id004b635cfd8e77de85f932a3035870300ba1c47
2022-08-17 13:30:07 +02:00
Ashod Nakashian
6f969932bf wsd: remove lastUploadTime as it is redundant
Change-Id: I5dee3ed1a77c3672056e3cfc894192d334ae5c15
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-06 20:38:09 -04:00
Ashod Nakashian
b96ea2f9e7 wsd: move minTimeBetweenUploads into StorageManager
Change-Id: I3c4ff6146d2950b618effc348aa3a44c2cfa2c85
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-06 20:38:09 -04:00
Ashod Nakashian
2cee775e0e wsd: move minTimeBetweenSaves into SaveManager
Change-Id: I00336230f80557e0986a2ea6d29b1f498f04fe0a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-06 20:38:09 -04:00
Ashod Nakashian
704a99824a wsd: cosmetic and logging
Change-Id: Icca69e8b70e93693c5c94bce897091d3b75dc385
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-06 20:38:09 -04:00
Ashod Nakashian
5e0c29c73b wsd: move the autosave interval into SaveManager
Change-Id: I79e33e3089a4da0c1d968b0fdbc2f4bab55c4fc6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-06 20:38:09 -04:00
Ashod Nakashian
caacf21710 wsd: add min_time_between_upload_ms config
This introduces a new config entry to
control the minimum time between uploads
after a failed attempt. In the case of
a successful upload, the minimum time
between uploads is bounded by the
min_time_between_save_ms config.

Change-Id: Ic7e37f97a52af2c5ec82897b6e81f57211d16553
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-06 20:38:09 -04:00
Ashod Nakashian
2d695a489e wsd: add min_time_between_save_ms config
This adds a new config entry to help tune
how often to save after the last save
request. This is used regardless of
the auto-save interval.

Change-Id: I58c291e69a63a3b98e72584817b408b54d9f80f1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-06 20:38:09 -04:00
Aron Budea
d30b423c07 Replace #ifdef-s with #if-s, and enable -Wundef
...for variables coming from configure.ac.

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I39ebd21c4cb56d2a3bd38fdc35dc59b5f1fd4b49
2022-08-03 11:07:38 +02:00
Ashod Nakashian
c2ba9c8a77 wsd: extend the fork timeout when copying systemplate
While bind-mounting is very fast, linking and copying
are both often much slower. Normally, we give extra
time to forking Kit the first time, but then we
reduce the timeout there after. Here, we take into
account whether or not bind-mounting is enabled
before we reduce the timeout to the normal level.
That is, if bind-mounting isn't enabled, we leave
the timeout to be higher-than-normal to accomodate
slow linking or copying.

The benefit of this is evident in the stability of
tests when bind-mounting is disabled (even on fast
filesystems with linking).

Change-Id: I959abf6d3253b2c91be8e0c9a59ec12511817bb9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 14:45:12 -04:00
Ashod Nakashian
5c6516e4e4 wsd: support code-coverage report via --with-coverage
This adds support for code-coverage HTML reporting.
To achieve this, we must use file-linking in jails
so that we can update the coverage data (.gcda files)
from the jails. This means that creating jails is
slower than with bind-mounting and we need to
account for that in our timeouts.

We also can't kill child processes with SIGKILL,
which is un-catchable. Instead, we use SIGTERM
and dump the profile data before exiting.

Change-Id: I16fa534f6ed42f7133014d841bb024423315e0a4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 14:45:12 -04:00
Ashod Nakashian
b77dfc47d2 wsd: remove default arg from SigUtil::killChild
Explicit is always better. We also need to
terminate more gracefully when profiling.

Change-Id: I7145cb59583c5d7c6362bbf9c74e9d21799eaa33
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 07:51:52 -04:00
Ashod Nakashian
4e9b836ea6 wsd: always use Util::forcedExit to properly cleanup
We need to flush and shutdown logging before exiting,
so we can't use _exit/_Exit directly.

In addition, with profiling (e.g. code-coverage) we
must flush the profile data, lest it's all for naught.

Change-Id: I726c5a2f4e699c17dd0d7d5b1c86d856e0118b3c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 07:51:52 -04:00
Mert Tumer
2cf9f7bc1b android: fix closing the document on interactive dialogs
We get stuck on exitting the app progressbar on mobile
with the interactive dialogs such as csv import or macro security
dialog, we have a different use case for killing the document
as in the normal case. We are not running a separate process
but a thread and we dont trigger regular killing use case.

This piece is not relevant for android because we always have
one connection through fakesocket until the main thread is killed
and it is waiting on the mutex to finish before we finally exit the
document activity.

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I99bd333152d40a04f95d4747705a721112317bb2
2022-07-30 10:52:16 -04:00
Ashod Nakashian
2044625122 wsd: improve logging when kit disconnects
Change-Id: I65d18aea265e5e68ee823676028266fa543e0667
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-29 13:59:28 -04:00
Ashod Nakashian
dd6c5b1d81 wsd: correctly stop DocBroker from interactive mode
When in interactive mode, the user has a dialog
to interact with. The issue is that the user may
dismiss said dialog, the Kit process may stop,
crash, or otherwise exit. This basically leaves
DocBroker in a deadlocked state, expecting
input from the interactive document, which
will never materialize.

Here, we rely on the machinery already in place
for flagging such a DocBroker that has no Kit.
We check for said flag and stop DocBroker if
such a case is detected, exiting clearly.

Change-Id: Iecb91c49226da08567cdd2c5d050d458e2f0fc9b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-25 10:45:23 -04:00
Aron Budea
81e1e0a51e wsd: slightly improve logging in case of version mismatch
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I586da3390487727f0d4b743d4d285cce59f7d55b
2022-07-25 06:23:19 +02:00
Rash419
c91b8b01b4 wsd: new config entry to add unlock_link for feature lock dialog per alias_group
- also added unlock_link option in dynamic configuration

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I075a4aed4f82059714412def965a8ed4d3581b2f
2022-07-20 17:41:19 +05:30
Rash419
9bb0b6fabd introduce new options to customize featurelock dialog
- adds two new options
1. localize the dialog
2. change upsell image shown in dialog using proxy handler
- provides all the settings using dynamic configuration

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I7e21c1b31c806c88bf54f891de40f02fa342168f
2022-07-20 17:41:19 +05:30
Pranam Lashkari
e65d923e9f add server id to capability list
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I1f101d8091a5fae64f19b8d4ace7b2db7d5cf5b1
2022-07-18 13:01:36 +01:00
Ashod Nakashian
45b7eb778d wsd: reuse parsed message
Change-Id: I9d67f92ba99037954400e07a7d1101e5de3716fd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-15 11:14:14 +01:00
Henry Castro
c9178b0223 Add home mode option - enabling more configurability for CODE.
Requested by several users and partners - defaults to off/un-changed.
When set it allows optional disabling of welcome/feedback when used
in a homely environment.

Also bump default max doc/conneciton limits in configure to 10k.

Change-Id: I3c917901e02445d45f6f86b554d47a60aa4e575d
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-07-14 18:24:43 +01:00
Ashod Nakashian
b0d6e1b859 wsd: sig: forward USR2 to child processes
We now have USR2 signal that dumps the
stack-trace of each process. This is useful for
capturing the state of misbehaving instances.
COOLWSD forwards USR2 to forkit and the kits
so they dump their stacktraces too.

This patch does not change the behavior of USR1.
Specifically, unlike USR2, USR1 is not forwarded
from wsd to frk and the kits. Also unlike USR2,
USR1 dumps into stderr.

Change-Id: I1d82f678f30f430f627692cc42961b1928f69e11
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-12 13:43:43 +01:00