Commit graph

1762 commits

Author SHA1 Message Date
Henry Castro
cedf950a52 wsd: add interactive state
Add a new state before load the document,
when Macro Security dialog popup, and avoid
to send the event load timeout.

Change-Id: I5973c5205e90e5447e5478cbab895709a68606f6
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-03-03 09:18:15 -05:00
Ashod Nakashian
561a9ce991 wsd: storage: upload to storage using http::Request
This converts Poco to http::Request in sync mode,
thereby not changing functionality. In a follow-up,
this will be converted to async.

Change-Id: Ifbecd44ff599394799c1131470d77f803ed8cc45
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-27 08:57:25 -05:00
Henry Castro
851c532508 wsd: revisit log messages misc files
LOG_FTL = abnormal, crash, denied service
LOG_ERR = load, save, session, connection, wrong parameters
other cases LOG_WRN, LOG_INF

Change-Id: Iaddfcf7f0853abfa96948fff28acda606cf88b55
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-02-23 23:48:19 -05:00
Henry Castro
bac79a1a4a wsd: revisit log messages Storage.cpp
LOG_FTL = abnormal, crash, denied service
LOG_ERR = load, save, session, connection, wrong parameters
other cases LOG_WRN, LOG_INF

Change-Id: Ia014602cc3288f5cb0e2b06fd46cdf0ad7294f43
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-02-23 22:04:24 -05:00
Henry Castro
aad38107d8 wsd: revisit log messages FileServer.cpp
LOG_FTL = abnormal, crash, denied service
LOG_ERR = load, save, session, connection, wrong parameters
other cases LOG_WRN, LOG_INF

Change-Id: I44b84853e951f5a9d6a8bbb5bd0ceebcff75abe2
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-02-23 21:36:11 -05:00
Henry Castro
41a7767c86 wsd: revisit log messages FileServerUtil.cpp
LOG_FTL = abnormal, crash, denied service
LOG_ERR = load, save, session, connection, wrong parameters
other cases LOG_WRN, LOG_INF

Change-Id: I1f6708c566fc69edc76e7c0d32625f6b1f4b3af4
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-02-23 21:35:14 -05:00
Ashod Nakashian
0292334805 wsd: properly log time duration natively
Change-Id: I12d900d44d0f79932f4454f06a16d1e1b727ab63
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-22 14:24:36 -05:00
Ashod Nakashian
135359afff wsd: storage: better handling of failed http requests
Change-Id: Ie7a855b692f3de28092b6b59ff4627fc4e5534ea
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-22 14:24:36 -05:00
Henry Castro
c24c7d9335 wsd: add an option "batch mode" to load the document
disable any dialog interactivity

Change-Id: I6d6fde721c7b3c18c519f87139525fcac1f6fb31
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-02-22 14:59:59 -04:00
Henry Castro
2c52b53f25 wsd: set state loaded when "statusindicatorfinish:" received
Normally the client session waits for a message
"status:" when the document has loaded to forward
to client side. However, when the document has macros
embedded, and a Macro Warning Security dialog popup
it will never receive the "status:" message.
So it is added "statusindicatorfinish:" to formally set that
the document has loaded.

Change-Id: Id40b853c002403577d7664c4f8206cb5a01403b6
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-02-22 14:58:37 -04:00
Gleb Popov
21bfa19e9e Fix compilation with libc++
```
wsd/DocumentBroker.cpp:772:57: error: constexpr variable cannot have non-literal type 'const std::chrono::system_clock::time_point' (aka 'const time_point<std::__1::chrono::system_clock>')
        constexpr std::chrono::system_clock::time_point Zero;
                                                        ^
/usr/include/c++/v1/chrono:1355:28: note: 'time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000>>>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move con
class _LIBCPP_TEMPLATE_VIS time_point
                           ^
```

Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I88c5466b8ad104178cf7fa4101f5f5265ccf5e86
2021-02-22 14:39:57 +03:00
Ashod Nakashian
f24aec95e2 wsd: reuse RequestManager in SaveManager
Change-Id: Ic1842d126edeb8e8771998466aba79598e741a68
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-21 13:07:05 -05:00
Ashod Nakashian
3431a68709 wsd: simplify, comment, and organize RequestManager
Change-Id: I92d19bb0e0d13ae2c1683e5703924dbd87d47d2f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-21 13:07:05 -05:00
Ashod Nakashian
550bddc27b wsd: storage: GetFileInfo with http::Request
Change-Id: Id04ece6918b084f5192ca357220afff6bf9fc987
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-20 16:47:17 -05:00
Ashod Nakashian
f5f1a64591 wsd: storage: download with http::Request and http::Session
Change-Id: I11e553fd65faf4d33c51f9b6e7e6e256fd87ba05
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-20 16:47:17 -05:00
Ashod Nakashian
f056d2be01 wsd: set the result of saving and mark the response time
Change-Id: Ia31376c38b4bad3dc15f618c902258af9b8f81f2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-20 16:47:17 -05:00
Ashod Nakashian
c1da9af494 wsd: Loaded -> Downloaded
Disambiguate between document loading
and downloading.

Change-Id: Ia16e580d8239a1aebd9192e01860e2f17cdc3878
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-20 16:47:17 -05:00
Ashod Nakashian
26d0d48b4c wsd: wopiLoadDuration -> wopiDownloadDuration
Consistent with names elsewhere and less confusing.

Change-Id: Ia72cdef0f6d6cd9589ce54028472e10008cf882c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-18 11:08:38 -05:00
Ashod Nakashian
d0516b4391 wsd: correct GetFile duration tracking
The download operation itself is done
after reading the response from the Poco
object. Therefore, the time duration that
was captured for the GetFile operation
was inaccurate. Luckily, we only need
to time the download API of the Storage
object, which actually is simpler, and
more accurate.

Change-Id: I05c94a29fa59d5efae215f2daea17672abc6efc7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-18 11:08:38 -05:00
Ashod Nakashian
ce9276f201 wsd: actually compute the CheckFileInfo duration
For some reason, the duration of the CheckFileInfo
request was not set/updated, and therefore it was
always 0. This fixes this oversight and also
moves the duration variable locally, since
the request is synchronous anyway and there is
hardly any reason to store it elsewhere.

Change-Id: I613b24311bc5c8ee9ab98d675057f354990226e8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-18 11:08:38 -05:00
Ashod Nakashian
a350dad19b wsd: Save -> Upload in StorageManager
We use download/upload in the storage
and load/save elsewhere, to avoid confusion.

This renames 'save' to 'upload' in the storage
for consistency.

Change-Id: I9ac991c2b52e2586b97c58db02110ff04bfd17d3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-15 09:54:41 -05:00
Ashod Nakashian
81da7c7bff wsd: download templates by wsd
Templates were downloaded by Core
upon loading. This works fine, as
long as there is no special network
setup in loolwsd. However, when
loolwsd has a complex network setup,
such as when using reverse proxies,
Core wouldn't know about the details
and would likely fail to download
the template.

Luckily, there is no reason to rely
on Core for downloading templates.
Instead, we download it in loolwsd,
just like any other document, and
load it in Core as normal. The
remaining post-load saving of
templates remain unchanged.

Change-Id: Ib22ada4ae469863d5e5c8baeee27f667f7cd40ff
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-15 09:41:17 -05:00
Ashod Nakashian
725f19ab4d wsd: encapsulate common request members
Instead of inheritance we use composition
to preserve the uniqueness of the members
of SaveManager and StorageManager.

Change-Id: Ifad82787e54089d49226085e009ade67bfc7938a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
0a8eaff48b wsd: track the timestamp of the uploaded file
This will be used to detect whether we need
to upload the document or not.

Change-Id: I2c5f6d058b1a8e0a6ab20c9561b6701413fb5878
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
9a040ac815 wsd: add fixme/todo for forced uploading
Change-Id: Ic6c0a50c6ee493625fe7efae3b98fdd5f52344a8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
e5d33a7f3e wsd: lift lastStorageUploadSuccessful into RequestManagerBase
Change-Id: I06eba0b539ecc0586be3aea178120f23762229d3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
8046de6146 wsd: lift ModifiedTime into RequestManager
Change-Id: Id02f7ba58e96b6b93d38cfe8f15c74ce2553517d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
4282f5b10a wsd: introduce RequestManager
This is to encapsulate and track the
common logic between SaveManager and
StorageManager.

Change-Id: I0c5a59edb8a26b258ba66d65983e2f76198ecbc9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
8035c99f3b wsd: move lastSaveTime into StorageManager
Change-Id: I74f4bdf00e94a7010ff8f7a9389613beedb64fad
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
92487cfa5d move lastStorageUploadSuccessful into StorageManager
Change-Id: I33a64b9bbb596bcd819adbfd5d7dcee0180bb5fb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
6bfbcf7a5f wsd: move documentLastModifiedTime into StorageManager
Change-Id: Ib33e5d142ce59b8d57177b1fd91cc309063a2d59
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
4fc574e539 wsd: introduce StorageManager
This is to encapsulate and track the logic
for uploading documents from the Storage.

Change-Id: I5b972151fe9548526755d18063d37cc95949e68f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
55b49a3c14 wsd: separate save handling from save-as and rename
We should only update the save timestamps when we
really save a new version of the document.

Requesting renaming or moving ("save as") in storage
should not be confused with actually saving in Core.

Here we take the first step in this separation,
and we only update the last save response time
when we truely get a response from Core, and
not when we execute a document path/name in storage.

Change-Id: I931c62b306dd3b4906a9e910f844a35fb3f4b6f0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
d8cddcea06 wsd: lastFileModifiedTime -> modifiedTime
The SaveManager is responsible for the file on disk.

Change-Id: I92f7843375fdc875bc7d1af3fba387f67a4f0ca5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
d806353af1 wsd: move lastFileModifiedTime into SaveManager
Change-Id: Ic3dd4f193e1676a47288bc77e75f6643438bafc7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
76be0d562b wsd: move save tracking into SaveManager
Change-Id: Ic98cc50469f1e25bb2e007554e1d9d42e020dc91
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Ashod Nakashian
ea96f43df9 wsd: introduce SaveManager
The SaveManager is responsible for the document's
save state. It also encapsulates the members
necessary to track the save state and related
data.

Change-Id: I3ed0f1d93f25988b1ad8b1a121a2080288866a53
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-13 13:25:36 -05:00
Tamás Zolnai
d0deb5eaa0 wsd: filter-out redundant 'formfieldbutton' messages.
Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Change-Id: I37834c63631fa44c9d37c9e1a4d448c1fef68c9e
2021-02-10 16:51:30 +01:00
Ashod Nakashian
bafcc98285 wsd: support FileUrl
Change-Id: I433b5f79956be9d8557df1a1f433a99d6ae10f65
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-09 10:45:37 -05:00
Ashod Nakashian
ec58e833e8 wsd: refactor downloadStorageFileToLocal
Prepare to support FileUrl.

Change-Id: I0ac4eccb937653ba86e74c2e6cecb7ddd5dd4ffe
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-09 10:45:37 -05:00
Ashod Nakashian
f7d61ae0d3 wsd: remove single-use member
And a couple of const cases.
The removed const is to allow move on return.

Change-Id: I7a81b531e75c39379871f5ffeb82d49ba1110ab1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-09 10:45:37 -05:00
Aron Budea
c4faeb049b wsd: tweak SSL logging
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I4e1e4f99cd2ac3d21b9426602de11e10bdd47a61
2021-02-06 21:43:03 +01:00
Ashod Nakashian
2304b52587 wsd: correct assertion on storage and not tilecache
We already access _storage before the assertion,
so it must move before the first use.

Also, we have no use for _tileCache when uploading,
so no point in asserting its validity here.

Change-Id: I4196d0719e6750cfd2dba8d5f449a1b76286bde9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
8a37738fdb wsd: documentation of DocumentBroker states
This details the design of the DocumentBroker
states and state-machines as they are to be
eventually implemented. Not everything described
is current, but the goal is to document what
the design ought to be, not what it is.

Change-Id: I938177812777af058b46c41a396407d0a083cbc4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
aba6d5b6c5 wsd: log at info level when we force uploading
Change-Id: Ic6da7e2c0f29ddbf5884b75866794609f69f8a8f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
523cfec790 wsd: save -> upload
Change-Id: I08445bd9f726225809c443f4bdfc611bbfc03bf6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
30f7ea2e9a wsd: remove default arguments of uploadToStorageInternal
Only the last argument (force) was implicit, and only
in one call (of total two calls). Explicit is better.

Change-Id: Ic26f4dd265f48156d1730f1b95bb70145ca47873
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-31 22:20:59 -05:00
Ashod Nakashian
2b96bf3fd6 wsd: move the loaded flag into DocumentStatus
The loaded flag is used to track whether or not
the document was ever loaded. It does *not* reflect
whether or not the document is currently loaded,
rather it is used to save the document, if necessary,
before unloaded.

This is why we need to track it as a separate boolean,
rather than implicitly tracking this state via the
DocumentState enum, which would not be able to
differentiate between a failed-to-load state and
one of a normal end-of-life, after loading.

Change-Id: I1fc3fb09c31cadf7ebb6b0123e462e78dd0af356
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-29 09:22:36 -05:00
Ashod Nakashian
048c468caa wsd: move the markToDestroy flag into DocumentStatus
The markToDestroy flag tracks whether or not the
document is in the process of being unloaded.

Change-Id: I8f2339f75ed6d7c5d318eb1d467d6a9cbc1d61c2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-29 09:22:36 -05:00
Ashod Nakashian
1041346928 wsd: move the closeRequested flag into DocumentStatus
The closeRequested flag tracks owner termination.

Change-Id: I91d7491396cd8db6ca493ba8015a5310c361a2f3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-29 09:22:36 -05:00