Commit graph

2192 commits

Author SHA1 Message Date
Henry Castro
a3d0920e18 wsd: infobar: clean up unused code
No longer used.

Change-Id: Ifdaaabc49df1b9af0fb4d436ffe2437446f5926a
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-05-12 18:25:10 +01:00
Henry Castro
78e277b764 wsd: infobar: send latest version to the client side
Change-Id: I565d9d30c86ec12e7ee96df55ac8adc2e718626a
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-05-12 18:25:10 +01:00
Henry Castro
7ed475f25c wsd: infobar: fetch and save the latest version data
Change-Id: I7988fc69d4eaa35a26463cf180c26c6fd9b083e1
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-05-12 18:25:10 +01:00
Henry Castro
59ca7a1a28 wsd: infobar: add config value "fetch_update_check"
Every number hours will fetch the latest version data.

Change-Id: I082d9ebb674058c6509dbd33537f24ec7cd9228b
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-05-12 18:25:10 +01:00
Michael Meeks
c0cd95b8fb delta: document ids decorating previews.
Change-Id: I2f6ade6c2de962c24f7b1a10c57aeb065b62e679
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 11:48:33 +01:00
Michael Meeks
8eebe1e345 Tile-deltas, expose TileData to unit tests.
Change-Id: I5f33a56009927187b460775129f0818f47843368
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 09:35:47 +01:00
Michael Meeks
71ef6cb4a5 Switch Tile to have a list of deltas.
For each tile, the wire-id will grow incrementally for each key-frame
or delta appended; so we can tell which deltas to send.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ic5f201d23273c37eed232c5932b9da854e80d06a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-10 09:35:47 +01:00
Michael Meeks
0a983d1282 remove unused TileCache::removeStream.
Change-Id: If517f8f5426086fe40871027d241250d6d34e67f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-05-09 16:40:57 +01:00
Ashod Nakashian
1c07d507ee wsd: do not enqueue messages on closed sessions
Also corrects the counting of number of active
sessions when broadcasting messages.

Change-Id: I5ab5995ed2cbc18b215542d0b2c9568957fd6a3a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-05-07 14:14:22 +01:00
Ashod Nakashian
a674a0d52e wsd: detect lost upload on exit and dumpState once only
Change-Id: If5a9601d9baa10dcdab38c57bfba82a45d8e5024
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-05-07 14:13:41 +01:00
Ashod Nakashian
c5e533f943 wsd: forced exit after cleaning up jails
The static instances cause a lot of grief
when they aren't called in the correct order.
Worse, when we are cleaning up, we don't
even initialize some of them (Admin, for one).
This means that a normal exit will destroy
what isn't created, in some cases (Admin) it
will even force creating instances when we
are destroying others.

This avoid all this by simply exiting bluntly.

Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 231fae4ebd990cb344143759cbdfa19c4f30d4f2)

Change-Id: I6a9443ca5ab999ed6ca1d27314136472cfc6ddb6
2022-05-06 14:45:34 +01:00
Ashod Nakashian
757529aad2 wsd: cosmetics
Change-Id: I85773b4c06c051ee8c52c353e26dd6149c7843de
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-05-06 14:45:34 +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
Ashod Nakashian
40839e8019 wsd: browser: Reset_Access_Token API to update access-tokens
Change-Id: I92cc424c30824232eaf156ddfe49104932b2ba81
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-05-06 11:13:35 +01:00
Rash419
2163e2f043 wsd: cleanup setting firsthost code
we added AllHosts to give admin the err log that host is not in alias_groups but now as we removed the host list entries from configuration we don't need that log

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8b5e9e6b7df7df59befb496c12966c7ddc60c707
2022-05-05 11:04:22 +05:30
Miklos Vajna
aeea180e7f wsd: fix log message typo in COOLWSD::innerMain()
This went wrong when the forward-port of commit
b96e8b7c77 (wsd: correct use the exit code
from UnitWSD, 2021-11-29) didn't adapt the string to the updated
filename.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ica8047dc05dedf9e075663f405dea89913cf789a
2022-05-04 09:05:48 +02:00
Jan Holesovsky
8bc02b71e8 Improve error reporting related to remote config
Signed-off-by: Jan Holesovsky <kendy@collabora.com>
Change-Id: Ie458464d60bf8e939c1408e1b0feb91090d080e4
2022-05-02 22:00:57 +02:00
Jan Holesovsky
3b6c531389 Allow specifying the remote_font_config URI in the remote_config
This way, there is only one entry point for all the remote
configuration, and the remote_font_config does not have to be specified
in coolwsd.xml, in case the remote_config JSON specifies that.

Signed-off-by: Jan Holesovsky <kendy@collabora.com>
Change-Id: I857bab3d300ddb5c0c3df0a9f62eda20f43c3ff7
2022-05-02 22:00:57 +02:00
Henry Castro
455532c218 wsd: admin: fix typo
Change-Id: Ia9714fbadf7cdafa84fd58354e1b72dc36084ad3
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-04-27 09:18:21 +01:00
Henry Castro
6bfe68ea93 wsd: add parameter --signal
To signal SIGUSR2 to parent to notify
that the server is ready to accept connections,
and begin the tests.

Change-Id: Ie936217243aa7a2e836f3d45cb508ede13fae8c5
Signed-off-by: Henry Castro <hcastro@collabora.com>
2022-04-27 09:18:21 +01:00
Tor Lillqvist
8ff5f1c57c Restart ForKit when a downloaded font has been updated or removed
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I62b53bb4ff16eac3e122f9b6d702c69d2355595d
2022-04-26 17:26:20 +01:00
Pranam Lashkari
138a98385a wsd: do not set default close reason
we preserve original reason,
so setting default reason means always using default reason
and ignoring any other reason

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I837a13a129aa759a319406affc6e89425bf31361
2022-04-26 15:57:51 +05:30
Ashod Nakashian
14d96957cd wsd: log macro cleanup
* Simplify log macros.
* Reduce expanded lines (faster compilation).
* Avoid flushing (since we always use ostringstream).

Change-Id: Id10c1a75b5af5d8cdba62d768192ab0a6a9e0aca
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-26 11:13:44 +03:00
Rash419
0945c4d48b config,UI: change classic -> compact and notebookbar -> tabbed
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I633a13927245ee6b4d750cd84c2b4577dca06d68
2022-04-25 13:56:10 +05:30
Ashod Nakashian
89234116dc wsd: delay uploading if the last attempt had failed
Change-Id: I1c251fdeadf355b003a71408fba31d1ac975822f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-22 17:23:34 +01:00
Ashod Nakashian
9e7a4ad3d0 wsd: needToSaveToDisk helper and improved autoSaveAndStop
Change-Id: I149a624a8acb005f441d79e0c1f4776e7a2d49c0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-22 17:23:34 +01:00
Ashod Nakashian
e3045b513c wsd: add canSaveToDisk helper
Change-Id: I8ad6c91ac05d60e29726a20d67799aa11714226a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-22 17:23:34 +01:00
Ashod Nakashian
83e96e58bd wsd: add canUploadToStorage helper
Change-Id: Ieba59e3cfc5d26c78a118f8d4fae8a151ac62ef3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-22 17:23:34 +01:00
Ashod Nakashian
8db2dc86fe wsd: do not prevent saving when storage is missing
Since we have the ability to quarantine documents,
we should save to disk even (or especially) when
we don't have a storage instance. This way we
can at least recover the document.

Although it's not clear when we will not have
a storage instance, if at all, separating saving
from the storage state is reasonable.

Change-Id: Ifa51ed3229424b567df8218b201ef914226db947
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-22 17:23:34 +01:00
Tor Lillqvist
551c3d96e5 Enable avoiding use of ETag for remote font files
Change the syntax of the remote font configuration JSON file. Now for
each font we can also have a "stamp" property that can be a time stamp
or whatever other random string that gets changed (by some automated
mechanism provided by system integrators) whenever the corresponding
font file has changed. If a such is provided we don't poll the ETag of
the font file but re-download it whenever its stamp in the JSON file
has changed.

The remote font configuration file now should look like this:

{
    "kind": "fontconfiguration",
    "server": "My pretty server name for admin console",
    "fonts": [
	{
	    "uri": "http://localhost/tml/MS33558.ttf"
	},
	{
	    "uri": "http://localhost/tml/SmoochSans-VariableFont_wght.ttf",
	    "stamp": "foo0"
	},
	{
	    "uri": "http://localhost/tml/B612-Regular.ttf",
	    "stamp": "foo3"
	},
	{
	    "uri": "http://localhost/tml/xxx.ttf"
	}
    ]
}

Where the value of the "stamp" properties can be any non-empty
string. The JSON file is checked once a minute. If it has changed it
is re-downloaded, and if the stamp of some font has changed, that font
file is re-downloaded.

When a font file is re-downloaded it is stored in a new file each
time. The old file is not removed as that will cause problems in
ForKit and Kit processes.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ib04b77e0fb9e1d9c33afdc14a5fed3ad0b12a409
2022-04-21 19:10:10 +01:00
Ashod Nakashian
92c6428e4b wsd: minor log improvements
Change-Id: Iea317ac1a04163d9eb45b8ac2b6d1c4f9f77009c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-20 08:34:59 -04:00
Ashod Nakashian
16617bee2d wsd: fallback only when COOLStatusCode is missing
Since the json parser logs an error when the
entry isn't found, parsing both LOOLStatusCode
and COOLStatusCode almost guarantees at least
one ERR log entry. We should only fallback
when COOLStatusCode isn't found and avoid
erroring when we got what we wanted.

Change-Id: Icace964820c250f4ceba98281e57cb7c29fbd118
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-20 08:34:59 -04:00
Ashod Nakashian
96adaa15d1 wsd: kill coolwsd_fuzzer
coolwsd_fuzzer predates actual fuzzing
with libfuzzer and is currently unsused.

Change-Id: Id095b165943ba14dbf525ddc607ad329f5d952d4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-20 07:12:03 -04:00
Gökay Şatır
4e42a34b96 Attempt to fix:
error: call of overloaded ‘basic_string(const Poco::Dynamic::Var&)’ is ambiguous

Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: Ibaa77e94a8e12f1dbc38e40b14ce8184dafcd7bd
2022-04-15 17:32:41 +03:00
Tor Lillqvist
f98900c73c Add a remote font download feature
The coolwsd.xml file can now contain a URI of a JSON file on some
server that contains URIs of fonts. These fonts are downloaded to the
coolwsd server. Just like the remote configuration thing, the URIs are
checked once a minute and the JSON or the fonts mentioned in it are
re-downloaded if their contents has changed.

If a font has been removed from the JSON file then the corresponding
downloaded could be removed, too. But there is no way to remove it
from core without restarting the whole COOL server, so we don't
bother.

We need to put the font in such a place so that its pathname is the
same both in the ForKit process (outside any chroot jail) and in a Kit
process (inside its own jail(), because even if it is in the ForKit
process that we call the LO core vcl API to load a "temporary" font,
code elsewhere in LO core re-opens the font file later, naturally
using the same pathname, when it is needed (see
FreetypeFontFile::Map() in vcl/unx/generic/glyphs/freetype_glyphcache.cxx).

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: If78058ddff5ed05c7a82d7ea465a7a414fd0d861
2022-04-15 17:32:41 +03:00
Ashod Nakashian
622e0ddcb4 wsd: add and use isWritable helper in session
The new helper corrects inconsistencies in
detecting writable sessions and improves
readability.

A writable session is one that is either
not read-only or can change comments
(in PDFs, which are otherwise read-only
documents).

Also fixes a bug in reusing the last editor
session to save. The condition should've
been !isReadOnly(), since sessions used
for saving cannot be read-only. Indeed,
the last editor couldn't possibly have
been read-only by definition.

Change-Id: I9860be287057050eca692568d43f77371964f80b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-14 10:48:45 +01:00
Ashod Nakashian
0fc876bed4 wsd: correct active-session counting
The inWaitDisconnected state is mutually exclusive
with isViewLoaded. So that check was completely
useless. Instead, we want to check if the session
is still connected to the client, since isViewLoaded
implies that we aren't disconnected from the Kit.

This moves this logic to a helper in ClientSession
and streamlines the implementation of
DocumentBroker::countActiveSessions().

Change-Id: I06459708e4c59566aa2e2f1febdfdfe8dd491c35
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-14 10:48:45 +01:00
Ashod Nakashian
ea7d1cf981 wsd: check the stop flag immediately after poll
The stop flag may be set through the callbacks
that the poll fires. In particular, errors
during socket plumbing can set the stop flag.
Since this flag is final and immediate, there
is no need to do the normal processing and
check it on the subsequent iteration of the
polling loop. This reduces the wait and we
clean up faster.

When we don't check for the stop condition,
we may end up uploading an extra time.
This is particularly problematic with
always_save_on_exit, which forces the
upload. Since it sets the stop flag
after it uploads, we should detect it as
soon as possible and no do extra poll.

The change is guarded by EnableExperimental
to avoid unexpected behavior.

Change-Id: I67815e70383caabaf29aa4921e0c421c3e5ff96c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-14 10:48:45 +01:00
Ashod Nakashian
480fb7b931 wsd: move tokenizer helpers into StringVector
In an attempt to reduce the size of Util.{c,h}pp
which has grown to contain all sorts of unrelated
helpers, we move StringVector helpers into
the StringVector.{c,h}pp files.

This makes the code better organized.

Change-Id: I152f341606807ae66253415b951bc9f89b09df57
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Ashod Nakashian
d6a4069197 wsd: use STATE_ENUM for SessionState
Change-Id: Icfed4cb4db8af440582d0a9660ff3a00a4ce376f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
a15635aef6 wsd: include the ClientSession name in logs
Change-Id: Id7a601f1674949a22b937dd03265df6d759e0e31
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
f5c936ee63 wsd: add LOG_ASSERT to replace assert with extra logging
In NDEBUG builds, where there is no assert macro,
we log at debug level to still find issues without
adding noise to the logs.

However, in ENABLE_DEBUG builds not only do we assert
but we also log at error level.

Change-Id: I773dbf7bb2b459e505e73d91505b13d8ed2ed6d8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
d8745f288d wsd: logging and minor cosmetics
Change-Id: Ia6ba5b333c8caf742de27be46faf7265a1a777a5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
8cb8624b05 wsd: use STATE_ENUM for DocBroker states
Change-Id: I829b4e78185379705f9c6fb443feb1175c90f08d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Ashod Nakashian
e1b1f38922 wsd: log the duration of save and upload when done
Change-Id: I17e16667f67ad3f0ad9bdd8c02aceafa62dd72f5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-06 18:33:45 -04:00
Rash419
89f5989eab wsd: fix: log messages to coolwsd.log of firsthost and denied hosts
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I2bdc7b21d11afa70214e8cb498b7e2dec77ef655
2022-04-05 22:34:15 +05:30
Rash419
c2be0b3a48 wsd: add: support to define multiple domain with '|'
fix: in regex, escaping special character fails to find host of the alias

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I19bfacc5e45af26832cb8c6a7d249e0c7de56624
2022-04-05 13:47:57 +02:00
Rash419
13d644be2b wsd: removed host list from coolwsd.xml
- first host is by default allowed without any condition

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Iacca38868f06a417cbb99984e2dac1eef727df6e
2022-04-05 13:45:51 +02:00
Michael Meeks
db63703d0c Validate as utf-8 all Websocket text messages in debug mode.
Ensure that rendersearchresult: is terminated, and identified as binary.

Change-Id: I84e83c63351cd0aac0923bf7c833b14c1be2c051
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-04-04 20:46:11 +01:00
Henry Castro
c550a206e8 Remove the old vex-based welcome dialog code
... and make Welcome dialog optional for COOL

config: add welome url parameter

Signed-off-by: Henry Castro <hcastro@collabora.com>

config: add feedback url parameter

Signed-off-by: Henry Castro <hcastro@collabora.com>

config: add infobar-url parameter

Signed-off-by: Henry Castro <hcastro@collabora.com>

welcome: fix unhandled exceptions

Signed-off-by: Henry Castro <hcastro@collabora.com>

welcome: preprocess welcome file

added welcome-message.html

Signed-off-by: Henry Castro <hcastro@collabora.com>

welcome: clean up code related to vex welcome

Signed-off-by: Henry Castro <hcastro@collabora.com>

--enable-welcome-message is not necessary, when we specify a welcome URL, then it is enabled, otherwise it's user configurable

Signed-off-by: Andras Timar <andras.timar@collabora.com>

remove the unused welcome config settings

Signed-off-by: Andras Timar <andras.timar@collabora.com>

remove unused define ENABLE_FEEDBACK

Signed-off-by: Andras Timar <andras.timar@collabora.com>

do not install/package fallback welcome dialog, when welcome feature is not configured

Signed-off-by: Andras Timar <andras.timar@collabora.com>

remove welcome-message.html

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I20aa6220362018b63aaebd114b2b661561823fbb
2022-04-04 10:53:07 +02:00