Commit graph

165 commits

Author SHA1 Message Date
Ashod Nakashian
0a73175764 wsd: reduce string copies
Change-Id: Ib38d7ebf1e66680779720cc1ce4d9bd07f9cab0a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-11 01:05:20 -04:00
Ashod Nakashian
f494c27024 wsd: correct User-Agent usage in http headers
User-Agent is designed for client-side use only,
in http requests. For servers, the Server header
is designed to announce the server name and version.

This tries to normalize the use and documents
the proper intent and usage.

Change-Id: I42d68d65611cab64c45adf03fe74f9466798b093
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-22 10:09:22 -04:00
Szymon Kłos
5945b2d396 Hide Macro Selector dialgo from menu if disabled
Change-Id: I35d521341032ca23a13e8d6795d168ac32c9ec43
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
2021-03-16 10:41:36 +01: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
Gabriel Masei
99c9ac1723 wsd: allow different UI mode for different views
Signed-off-by: Gabriel Masei <gabriel.masei@1and1.ro>
Change-Id: Icad28de7a75a6392cafb4fd3385e564616ece499
2020-12-09 15:46:24 +01:00
Ashod Nakashian
70fa07f22e wsd: log helpful messages when we fail to cache files
Change-Id: Ie228edbcea4dfe83b2bd78c34ec2b4423d64f61c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-11-29 19:27:23 -05:00
mert
ffaf53d3ef Make Themeing related CSS vars UI Configurable
Change-Id: If6e4096dc37573ff116f218ceb4ca14135820ff7
Signed-off-by: mert <mert.tumer@collabora.com>
2020-10-30 11:20:00 +01:00
Jan Dageförde
d7656402d3 Migrate code to use generic sendError
Signed-off-by: Jan Dageförde <jan.dagefoerde@googlemail.com>
Change-Id: I0a00ea1220f19479eb021538f67b6bda0c59f7ef
2020-10-28 13:12:27 +03:00
Jan Dageförde
7206231ede Rewrite FileServerRequestHandler::sendError to rely on generic sendError
Signed-off-by: Jan Dageförde <jan.dagefoerde@googlemail.com>
Change-Id: Ib19f95868b61fa43375bf4b19372d9f3f68691dd
2020-10-28 13:12:27 +03:00
dilaverdemirel
29251ef432 Replaces Poco::DateTimeFormatter to Util::getHttpTimeNow #207
Change-Id: I49b8d4b2acb0d4bcc719325a28537d45700bebdc
2020-10-20 10:04:44 +02:00
Andras Timar
da7543a9e9 typo: its not -> it's not
Change-Id: I27526e14a44b5cb9fe8ad20b8b94bc6b79839ddd
2020-10-09 12:44:14 +02:00
Andras Timar
0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
Jan Holesovsky
4ad8773821 Make various bits of the UI configurable.
This adds the infrastructure to be able to pass the info which elements
like the statusbar / ruler / sidebar are supposed to be shown or hidden
on startup of the editor.

Change-Id: I188264dec6961074444934ff5fd7088e23b170d4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103169
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mert Tumer <mert.tumer@collabora.com>
2020-09-28 11:53:16 +02:00
Ashod Nakashian
e68be80496 wsd: add http-headers unit-test
This is to defend the sneaking of extra http-headers
in the access_header URI param that was recently fixed.

Change-Id: Ic28cf58854847ac278bed8043f398b107f7992b3
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96862
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 07:37:10 +02:00
Szymon Kłos
3141bf7775 notebookbar: Introduce switch in loolwsd.xml
Change-Id: I94546a899fde1cecc2c35dc527e41e8a36061750
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93050
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2020-06-30 08:16:25 +02:00
gokaysatir
5f07429b6b leaflet: Update admin console & drop bootstrap package.
Change-Id: I9243393693c2464f2e9a4d24cccf9c5f3415e2ef
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95468
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-06-04 12:56:16 +02:00
Michael Meeks
714640993b Remember to shutdown the socket after serving files.
re-factor to make it hard not to.

Change-Id: I26ebc48b4660276ede64a22167ac4779cebf5cd4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95440
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-06-03 18:15:33 +02:00
Ashod Nakashian
d2d0492245 wsd: move LOOLProtocol::tokenize to Util::tokenize
The tokenizer(s) are more generic than the protocol
logic, and are used from contexts that don't involve
the protocol as such.

Change-Id: Ie8c256bf11a91e466bff794021f41603c9596a7f
2020-06-02 18:03:36 +01:00
Ashod Nakashian
6ab64ac992 wsd: single-char string literals -> char
Change-Id: I163d6fe1c80334317d38f8fed2199ad2b31a0f8a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95335
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 17:22:26 +02:00
Ashod Nakashian
224ef08c7f wsd: single-char string literals -> char
More readable and typically more efficient.

Change-Id: I9bd5bfc91f4ac255bb8ae0987708fb8b56b398f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95285
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-06-02 01:31:26 +02:00
gokaysatir
ac682772a6 tdf#114982 - AdminConsole: control logging
Change-Id: I53cf4b0ff81ea9d6bf4ad595077f7365e7e34c00
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94130
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-30 11:10:19 +02:00
Jan Holesovsky
2a19330823 Proxy: Preprocess the localization files so that they contain the full URI.
Otherwise they are not passed through the proxy...

Change-Id: I307018e760ff99ac42c25ab7fa2fa3df4911ef8d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94811
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-05-25 22:44:34 +02:00
Michael Meeks
dec683218a Proxy: move RequestDetails to its own header.
Share it with various other places requiring similar data.

Change-Id: I873f56798f5a34dcf7440456bd649b68f6d3df98
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94069
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-12 20:30:17 +02:00
Michael Meeks
18c4301a1f Proxy: re-factor proxy handling into ServerURL and cleanup copy/paste.
Also adds ServiceRoot handling for clipboard.

Change-Id: I7bc6591130fcc7d693e59ab8561fb9e99f4e93d5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93578
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-06 23:12:12 +02:00
Michael Meeks
d439f8098d Proxy: improving parsing & URL passing for websocket to fix connect-src.
Change-Id: Id017c46e755eb14bc25d18be450b6100ff6bed92
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93094
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-28 19:34:15 +02:00
Michael Meeks
c9ed710518 Proxy: convert ProxyPrefix to a full URL.
Thus encoding the actual proxy's http/https state.

Change-Id: Ia7d5b8fb9379364b6c10a2c84d609f49e215ccb1
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93077
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-28 16:37:29 +02:00
Michael Meeks
87eac2079b ProxyPrefix: allow the user to specify a custom prefix.
This allows us to re-direct web traffic via a proxy quite simply
during fetch, instead of changing the service root.

Change-Id: I28d348467e48394d581fca4da4c199348a2ca8e0
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92804
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-24 12:48:11 +02:00
Muhammet Kara
f507302993 Welcome: Add config for enabling the dismiss button
Change-Id: Ia2fbf066493d91a2b10866e66d11332b5cfc10fa
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92593
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-04-20 20:35:08 +02:00
Muhammet Kara
aaf1fa4fc6 Welcome: Pass welcome value from loolwsd.xml to the JS side
Now we have window.enableWelcomeMessage on the JS side to avoid any
queries at all when the feature is disabled.

Change-Id: I8420089f775bfbf5bcd557c7c720172fbce8c22e
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92338
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-16 11:37:08 +02:00
Jan Holesovsky
e228e41389 Welcome: Handle language versions of the welcome files.
If eg. welcome-cs-CZ.html is not available, try welcome-cs.html and
fallback to welcome.html (which should be the en-US version).

Change-Id: I5df6a6d6da97fb3c111a709a63a54ee86248f73d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92274
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-16 11:34:41 +02:00
Jan Holesovsky
7f96586922 Welcome: Serve the release notes files from a given (configured) directory.
Change-Id: Iae36c1c48fee963659662436d594be659908a3e3
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92216
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-16 11:30:00 +02:00
gokaysatir
9e0594ee2d add pretty name - Android patch
Change-Id: If0de49884954cde26bfbe8ba1dce8844af5b30bf
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91831
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-11 13:43:31 +02:00
gokaysatir
a486bad79b tdf#130568 - Add server os pretty name to help->about
Change-Id: Id6de533dfb8e34a05d348f8ae701bf3c524c9b95
2020-04-01 20:45:32 +01:00
Miklos Vajna
a7d3efdd4e Introduce StringVector::equals()
Allows comparing tokens with C strings without a heap allocation. Do the
same when comparing two tokens from two different StringVectors.

And use it at all places where operator ==() has an argument, which is a
StringVector::operator []() result.

Change-Id: Id36eff96767ab99b235ecbd12fb14446a3efa869
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90201
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-03-09 09:46:33 +01:00
Miklos Vajna
b8bd1990aa Rework LOOLProtocol::tokenize() to return a StringVector object
The bulk of this commit just changes std::vector<std::string> to
StringVector when we deal with tokens from a websocket message.

The less boring part of it is the new StringVector class, which is a
wrapper around std::vector<std::string>, and provides the same API,
except that operator[] returns a string, not a string&, and this allows
returning an empty string in case that prevents reading past the end of
the underlying array.

This means in case client code forgets to check size() before invoking
operator[], we don't crash. (See the ~3 previous commits which fixed
such crashes.)

Later the ctor could be changed to take a single underlying string to
avoid lots of tiny allocations, that's not yet done in this commit.

Change-Id: I8a6082143a8ac0b65824f574b32104d7889c184f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89687
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-02-28 16:07:56 +01:00
Michael Meeks
aadf5af77b reduce verbosity of FileServer trace logging.
Change-Id: I5a57e91742be504bcb2e51b45f6890420e52bb91
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87134
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-01-21 14:39:21 +01:00
Michael Meeks
1c754d5b11 Revert "Serve a decidedly unpretty clipboard download page"
This reverts parts of commit da455c486a.

Unfinished; also stream size calculation cannot have worked.

Change-Id: I39635fe5165b82dd36095d58cfefff4920ce3a35
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86845
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-01-16 17:21:38 +01:00
Michael Meeks
b5f58fbe8c postMessage CSS checking improvements.
Ironically our attempts to double-check message origin against our
parent was blowing a security exception.

Instead send the list of origins we will accept from WSD, and
check them ourselves (as well as the browser check).

Why make it so hard to check that a postMessage comes from an
ancestor frame ?

Change-Id: I1311be3e1d68a31cfdc96b45a5eb5dd7f26e7ea9
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86788
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Alexandru Vlăduţu <alexandru.vladutu@1and1.ro>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-01-15 10:56:27 +01:00
Ashod Nakashian
7c4ba459ff Encode the ExtendedData to make it safer while embedding in messages
Change-Id: I1d4bdb2775d89e9a52a96d833228ca8577ee3561
Reviewed-on: https://gerrit.libreoffice.org/83044
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-11-22 01:51:11 +01:00
Michael Meeks
98617e40e2 Enable protocol debugging by default in debug mode.
Also add a config option for logging.protocol - to help catch early
protocol issues during startup.

Change-Id: I6f0cc6dcf14b2797bc6b2bd36c44750d74eb0608
2019-11-15 18:01:02 +00:00
Pranam Lashkari
a6b0e5b827 killpoco: removed StringTokenizer from wsd directory
removed use of Poco::StringTokenizer from the wsd directory using LOOLProtocol::tokenize and std::vecor<std::string>

Change-Id: Ic50b4d4d71d4ffd005aacf6aef0ed2bfde66d40d
Reviewed-on: https://gerrit.libreoffice.org/82569
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2019-11-13 09:51:04 +01:00
Ashod Nakashian
8c4edb5087 Reuse cookies from the browser
Reviewed-on: https://gerrit.libreoffice.org/78195
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 8deecf4ea6966c059458bdc71e365be426238e09)

Change-Id: I96bbdd3e71bc9d0ecfddea7debc0ebcc303a49ae
Reviewed-on: https://gerrit.libreoffice.org/81558
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-10-28 10:45:14 +01:00
merttumer
1e63a02be4 Added reuse cookie option for wopi client
Signed-off-by: merttumer <mert.tumer@collabora.com>
(cherry picked from commit 9b8aa96a18ce2eda11b5e51b2df5bb0d8cd822d2)

Reviewed-on: https://gerrit.libreoffice.org/78194
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 3ab7e500d83ed814a2d1ba1043df828b1b6c865f)

Change-Id: I61577189f461ef94523af13b3734d84a20a11222
Reviewed-on: https://gerrit.libreoffice.org/81557
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-10-28 10:45:04 +01:00
Henry Castro
f0661b2e58 wsd: include 'self' to CSP object-src
Change-Id: I5696a6ef6184aaf1acb5be43f489c30825306143
2019-09-29 16:01:22 +02:00
Ashod Nakashian
97a7b1f170 wsd: sanitize url when error reporting
(cherry picked from commit 2b35ae713943abd5f51de383fb2d26ab96f73988)

Change-Id: I7937429f2f987212beaeb9a97b48bfedb0a7ac58
2019-09-03 01:53:12 -04:00
Henry Castro
2872bc7be9 post logs JavaScript runtime errors to the loolwsd server
Change-Id: Ic8ccff52d2f051ea6d31b6d2bfe08fc08ea4d8c2
Reviewed-on: https://gerrit.libreoffice.org/77849
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Henry Castro <hcastro@collabora.com>
2019-08-20 18:24:04 +02:00
Ashod Nakashian
da455c486a Serve a decidedly unpretty clipboard download page
The initial bits to serving some page with provision
to ingest the different formats into a table.

Doesn't yet link with the actual document, but it's
a start.

The link will have some unique id(s) in it to
reference the document in question, which will
be some hash (possibly changing with some logic for
security reasons). This hash will have to be
something valid that WSD will use to locate
the DocBroker in question, connect to it and
fetch the formats supported and generate unique
links for each. When the user clicks on a link,
the contents will be downloaded in the given
format and copied to the user's clipboard.

The clipboard.html template is based on loleaflet.html
as we're very likely to use the same customization,
branding, localization, and javascript bits.

We would probably want to add a brandable title
with logo etc. and possibly some more reasable
background (ideally, an image enlarged and blured
to give the page some semblance of having content).

Change-Id: If0550184d4423bef1e98fecbb072bdf8df07701b
2019-08-05 20:26:13 -04:00
Miklos Vajna
d79666092d wsd: avoid UB in FileServerRequestHandler::readDirToHash()
wsd/FileServer.cpp:464:35: runtime error: null pointer passed as argument 1, which is declared to never be null
/usr/include/dirent.h:162:45: note: nonnull attribute specified here
    #0 0xbf566b in FileServerRequestHandler::readDirToHash(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/vmiklos/lode/dev/online/wsd/FileServer.cpp:464:27
    #1 0xbf8417 in FileServerRequestHandler::initialize() /home/vmiklos/lode/dev/online/wsd/FileServer.cpp:531:13
    #2 0x98617a in LOOLWSD::initialize(Poco::Util::Application&) /home/vmiklos/lode/dev/online/wsd/LOOLWSD.cpp:1155:5
    #3 0x7f17fc9c8263 in Poco::Util::Application::run() (/usr/lib64/libPocoUtil.so.60+0x3e263)
    #4 0x9c29f3 in main /home/vmiklos/lode/dev/online/wsd/LOOLWSD.cpp:3466:1
    #5 0x7f17fa739f49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
    #6 0x5c1e19 in _start /home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:120

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior wsd/FileServer.cpp:464:35 in

Change-Id: Iadb90c4e98981283718be3e3e9f55cb0b7a3e917
2019-05-23 16:42:59 +02:00
Michael Meeks
046ab32e46 Use compile-time rather than run-time string concatenation.
Saves some time & space.

Change-Id: If1e62056447fb7e8f26e8cf107451876adf3fecb
2019-05-20 12:30:01 +01:00
DarkByt31
8e34705fe2 tdf#107038 Poco::DateTimeFormatter with Util::getHttpTimeNow()
Added a function to Util to get current time in HTTP
format using std::chrono.

Change-Id: I9e7a732f585c1758c9348c450a01713a66f1e7b7
Reviewed-on: https://gerrit.libreoffice.org/72585
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-05-20 11:53:13 +02:00