We use [[maybe_unused]] to reduce explicit supression
especially under compile-time directives.
Change-Id: Ic5f3f3227a80efe52097cb35520d05b9cdaacb42
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
We no longer send LOOL-WOPI headers, unless
the configuration specifically flags for
legacy servers. But we always send COOL-WOPI
even to legacy servers, to help them upgrade
seamlessly.
Change-Id: Ifc919ed8f6665cd8f846117ef4e8b7ef09fbd563
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This replaces the synchronous loading logic
with the new asynchronous one.
Change-Id: I20fd7903cffbbd7c524d8051295113439ef75d5b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Quite possibly we did successfully up-load, or at least our timestamp
may not match, but we cannot be sure enough to warn the user in this
case. We cannot reliably get notified of remote alteration on the
server of files, so wait until a more succesful save or new user
join to get an improved timestamp.
Change-Id: I5c8124ed74ba5c26371768ac778b9670282c87a3
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
This excludes Wopi handling (as much as possible)
from mobile builds.
Change-Id: I4abb00f02e77b5d89d56ced49ce19a37ae93c13e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This allow being able to disable pick up of a local image. Handle the UI as well.
To be used with EnableInsertRemoteImage.
Return DisableInsertLocalImage: true as part of the WOPI CheckFileInfo reply
Default value is false (enabled)
Added an 'insertremotegraphic' button to the classic toolbar for use when
it's the only option.
Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: I1925f804433a7bda6025cb65b0943d78927bea15
StorageConnectionManager centralizes the
connection creation and management of
Storage sockets and related bits.
This is needed as we move to a more async
model of communicating with the Storage.
Change-Id: I7a44c95c113bbc536e922b5aa3f7cf9b71917c22
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Poco::JSON::Object::Ptr anonObject(object) is effectively a
const_cast and the comment in the header warns that object
may be modified, so just pass it by non-const and drop the cast
and merge the resulting duplicate stringify call
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9701ae95ff991b0dece854f295ba76ac9b3c2fa5
Now StorageBase::getFileInfo() is strictly
used for reading.
Change-Id: I0d412e7ef6e502ae8b1864131b6f174e44343273
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
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>
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>
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>
If we have no write-able sessions, we can't lock the document -
fair enough to complain, but not every ~300ms - so defer another
lock period in this case.
Change-Id: I7beb974b3c17fd6ac01a32d8fe50261a54340665
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Button is shown when CheckFileInfo contains 'EnableRemoteLinkPicker'.
After press UI_PickLink is send via postMessage.
Action should be finished with sending Action_InsertLink to editor.
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I53c61a25d1fab655771742ec6d97dc056192642a
The function-local static prevents tests
from changing the value of a config.
Change-Id: I5febdbf029293fab39f18afa6d905fd571d59545
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
it will be used to store user data which shouldn't
be shared between views
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I58b7f22e4364ce9e07bb6cc74e8431363912a872
We mark expired/invalid/rejected authorization
tokens and skip them in the future.
Change-Id: Iec89942198d566901cc2944f22ef86fcb4d6a820
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When present and equal to 'true', the 'Repair' button and/or menu entry
is hidden in the UI.
Signed-off-by: Jan Holesovsky <kendy@collabora.com>
Change-Id: If8075be479551e0d1a5fa03014aa5e4412578c31
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>
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>
It seems at least some storage hosts report disk-full
errors via 413. This logic of handling 413 error as
disk-full was introduced in
f8e0b8c11e.
Here we handle 413 as it is defined, as Entity Too Large.
Change-Id: I61297c2fab9de663643336a6eba47949f82d1737
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This allows us to use multiple hosts using same coolwsd instance.
added aliases configuration to coolwsd.xml to avoid
possibility of opening the same file as two if the
WOPI host is accessed using different aliases
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I32913015c15fd396cecc702b76e0dcaa8bcafad3
fetch JSON from remote server and apply new config without restarting coolwsd
- Extended the feature_locked configuration & functionality so that it can be set per wopi host ranges
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Id0e2b4b524a80de88b2b3559dd18c4a95b8163fb
We no store the origina modified time of the document
as we receive from the storage server in string
form and send it back as-is. This avoids any
potential issues with the roundtrip of conversion
to and from a timestamp.
Change-Id: I524bea8f36c3ce62dcd00c4fe6a1e7e083287ed1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This remove reuse_cookies as a setting and feature
altogether. It was originally a workaround to aid
with authentication, prior to having access_token.
However, it proved to be less useful than originally
anticipated, primarily because cookies nowadays have
security restrictions in browsers. In addition to
the fact that access_token simply deprecated it.
While the documentation has also been updated,
tests still have reuse_cookies in input data.
This is intentional to ensure the code is
backwards compatible with any deployment that might
still pass URLs with reuse_cookies around.
Change-Id: If214b299b34a910face8cabc7c1335621990c85e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When async save was started but we want to stop DocumentBroker
- we shouldn't kill the socket which listens to save result.
Because when we kill socket we will destroy DocumentBroker
before saving is completed, this allows for a minimal time
to connect again to the document and receive old content
from the WOPI storage. When we wait for async save result
we will keep DocumentBroker alive and next session can be
connected and receive correct content.
fixes: https://github.com/CollaboraOnline/online/issues/2747
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I5505a5ccc1f3d6928c723bddfea16bf5c5798d1e