Commit graph

14604 commits

Author SHA1 Message Date
Ashod Nakashian
7f8ddf0079 wsd: http: support creating http::Session from URIs
A full URI with scheme can now be used to
create http::Session instances.

Change-Id: I3e556e3e1aa247ccb93749d9bd6736a15290f442
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:58:06 -04:00
Ashod Nakashian
88dbe155e4 wsd: http: support sending http::Response directly to the socket
The Socket now accepts http::Response and
serializes it before sending it.

Change-Id: Id36e2d91b21d168da72ccdbd7e509ec08021b78e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:58:06 -04:00
Ashod Nakashian
0c48809593 wsd: http: Response writes out the body
It's now possible to set a body in http::Response
and it will get serialized out with the header.

Change-Id: If0f01a226bbd7b5ab092d0a246c8b46553a107e0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:58:06 -04:00
Ashod Nakashian
e3fa305896 wsd: http: get header entry with optional default
Change-Id: I6f11d9d39f3ba7b9e9907b3112f7317de3413071
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:58:06 -04:00
Ashod Nakashian
ac336419a2 wsd: http: comments and documentation
Change-Id: I3782e31d59c3664cade592b6b9d23a1ddf18f9ca
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:58:06 -04:00
Ashod Nakashian
f3b151132c wsd: test: use chrono for readable and safe time durations
Change-Id: I0e1b380af4cff8e364564d287c8291b206622f38
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
e9c5c0f812 wsd: add utility to parse URIs into primary components
With unit-tests.

Change-Id: Ie6ae1a4fee4863e27ea90af1cf476a72300fa10e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
0118ed6459 wsd: include cleanup
Change-Id: I9fc3b1156c8716722b9615e8f178185a4cad8fa1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
91ca2e9775 test: make run_unit.sh more helpful on failure
This improves the output on test failures and
makes it more consistent with the actual command
that failed.

Change-Id: I7f1bc90163e53efb0bd7cfb3a5892c7d4f0dad45
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
23cde8454a wsd: more informative SSL state reporting
Change-Id: Icd4b05e0190f1ae581cbe1b4e7df87bb439a63c8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
54a10729f3 killpoco: replace Poco::icompare
Change-Id: I9b8154538c85593f054afd17bd588a593b803e98
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
6bffc7cf53 wsd: case-insensitive string equality utility added
With unit-tests.

Change-Id: I89b3589d53d117fbd1f25fbdc5d9e0fc61df4b74
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
fd1f78cfb0 wsd: dump blank in hex dump for out of data
To differentiate between non-printable data
and no-data, we use '.' for non-printables
and print nothing visible (i.e. whitespace)
when we run out of data. This makes the hex
dumps more readable.

Change-Id: I8eeb78ab72d63ed613b7c330949063c0cb8cbfca
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
c00dce5a2e wsd: test: log connection security
Change-Id: Iaa81fa33dbbf5d82cdbb95ab39e6e5dbd6ef7104
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
9f4fcd098e wsd: test: make test assertion failures more obvious
Change-Id: Id076c9b270837840d8aa2bc88fa42e0861ad6df7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
5c6cd3aaec wsd: test: properly include config.h in the tests
When config.h is not included, the build
configuration is missing from the translation
unit in question. This affects ENABLE_SSL,
for one.

Also, HttpRequest.hpp depends on LOOLWSD_VERSION,
which is defined in config.h.

The config.h header must be included in all
trasnlation-units, and must be the first include.
This is to avoid conflicts and/or mismatching
binaries built with different compile-time values.

We also statically assert if LOOLWSD_VERSION
is not defined, to help the error message.

Change-Id: Ic4b45de879f3360a07e9507fdf04abfa4cec6a71
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 12:43:39 -04:00
Ashod Nakashian
a1761c880f wsd: test: use config to decide what URI to use in tests
With this, tests use SSL connections not just based
on the build settings (and whether or not config.h
is included in the test translation-unit), but also
based on the actual config, which can be changed
by the test in question.

Change-Id: I6cce5949e7785cee481fdc805a1804df6fdd8b8d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 12:43:39 -04:00
Ashod Nakashian
029fe9275e wsd: initialize config and use it in Kit
Change-Id: I0c6047ab2083b3fbfbade89d1c1ef04eb6e3b6c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 12:43:39 -04:00
Ashod Nakashian
08eab4bc15 wsd: more config features
Change-Id: I2fb33a2d89ab886bc454ae961dbff7b6c2c1b0ef
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 12:43:39 -04:00
Ashod Nakashian
db36d079ce wsd: pass the config from loolwsd to forkit
Change-Id: If89a5021bc7d86d630511abb65839f5448f4bd3d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 12:43:39 -04:00
Ashod Nakashian
e0aa90dd3a wsd: simplify lokit_main call
By defining NoCapsForKit and NoSeccomp
as const values for the KIT_IN_PROCESS
case, we have a more consistent and
simpler call-site.

Change-Id: Ife553eab9eaffd96560d4cfb4b8fdcdf26a1b9db
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 12:43:39 -04:00
Gökay Şatır
de62c0f359 AutoFillMarkerSection: Refactor rectangle vars.
Now the size and color are easier to see and update when needed.
Debugging code is deleted.

Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I9f89d71507a8fe7553f921e4c26c2097d3222b9b
2021-04-02 11:24:14 +03:00
Gökay Şatır
49be5105e5 AutoFillMarkerSection: Follow up patch.
Remove unusued variables.

Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I1b9b343d1e9388bb2b01da337da36f7dd3dc325b
2021-04-02 11:24:14 +03:00
Gökay Şatır
359ad0c80c Cypress test update.
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: Ie6474f66e2996e8c6786b4b19c233361fe362334
2021-04-02 10:10:15 +03:00
Gökay Şatır
8c27a9f2f1 Enable AutoFillMarkerSection.
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: Ic2cf7edbec1ca09259b555fee5d5972467cea291
2021-04-02 10:10:15 +03:00
Gökay Şatır
e381f9abd3 CanvasTileLayer: Remove _cellAutofillMarker svg element.
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I0516faa46d4693a7744df7e5bc13f1d566eba177
2021-04-02 10:10:15 +03:00
Gökay Şatır
e6a17878c0 LOUtil: Rectangle class follow-up.
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: Ib314aad2b1bd9faf6548857b27268c36a7c739de
2021-04-02 10:10:15 +03:00
Gökay Şatır
f2af95a797 CanvasTileLayer: Add pixel based variables for cursor and selections.
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: Ic1659e8eb562f82f136ddf59a7d59681d99855e6
2021-04-02 10:10:15 +03:00
Gökay Şatır
f3853f4dd3 LOUtil: Add rectangle class.
Which will be working with core pixels.

Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I2d2a9320d3eb9bd3899219bca4e9a2d3b951e3f2
2021-04-02 10:10:15 +03:00
Gökay Şatır
6973bc0b87 Calc: Add AutoFillMarkerSection.ts
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I5e934cb8eb7113390194c083a65b1580df7ee179
2021-04-02 10:10:15 +03:00
Gabriel Masei
21d514ecff admin: add support for lost kits cleanup
Signed-off-by: Gabriel Masei <gabriel.masei@1and1.ro>
Change-Id: I31969196aa138b6da964c867679ec23f34c89fd0
2021-04-01 22:09:44 +01:00
Ashod Nakashian
5cffde8734 wsd: limit the maximum PDF rendering resolution
Rendering PDF documents to images can consume
large amount of memory. Here we limit the
maximum allowed resolution to 384. This is
about 400% zoom resolution, given that the
100% resolution is 96 dpi.

If this proves limiting, it can be increased
to 480 dpi, which is about 500% zoom scale.

Change-Id: I719118d517bbaf8b204411223f1e26a31b97ca99
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-01 15:54:30 -04:00
Ashod Nakashian
c323da92d1 wsd: support configurable PDF rendering resolution
The defined envar is used by Core to override its
default resolution (of 96 dpi), when specified.

Change-Id: Ie7164e78f98990ac88b02dbfe2becbae8c134e9c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-01 15:54:30 -04:00
Ezinne Nnamani
f700867731 Loleaflet: Impress slide previews in vertical orientation are modified to fit
Signed-off-by: Ezinne Nnamani <nnamani.ezinne@collabora.com>
Change-Id: I49e69d5ecb765e09bcd1d9c584883a1e2841ac0d
Signed-off-by: Ezinne Nnamani <nnamani.ezinne@collabora.com>
2021-04-01 14:14:08 +01:00
Ezinne Nnamani
330b3bced2 Loleaflet: Paste shortcut CTRL + V does not work on comment dialog
Signed-off-by: Ezinne Nnamani <nnamani.ezinne@collabora.com>
Change-Id: I3bdf05ab3cd4159cb6e42f8705ad6987fa58ff08
Signed-off-by: Ezinne Nnamani <nnamani.ezinne@collabora.com>
2021-04-01 18:42:09 +05:30
Pranam Lashkari
b8c85e7237 impress: hide regular slides in master view
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I2b1ececba67fb8855187baafdc42cb5baa051635
2021-04-01 14:02:46 +02:00
Pranam Lashkari
8487972256 leaflet: comment wizard: update comment wizard without closing it
in addition now newly added comments will be highlighted by default

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I130674753d0b34fb9afed778e99907d1848daf76
2021-04-01 17:20:12 +05:30
Tor Lillqvist
fc19f64bfc Fix UTF-8 decoding and fix handling of non-BMP codepoints for IE11
The UTF-8 decoder here was buggy, and additionally it tried to feed
the Unicode codepoints it had constructed directly to
String.fromCharCode() even if that function takes UTF-16 units, not
Unicode codepoints.

The function in question is used only on IE11, apparently, so
presumably the problems had not been noticed.

Change-Id: I78f8ecea6ce6349e4121066774ae5c3fcfa87363
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-04-01 13:37:55 +03:00
Pedro Pinto Silva
fbba996383 Fix background color in which document page is placed
Avoid pure white and instead use another color for canvas background

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: I4cc9dffd19932bc631f5b880e53f8d413357d662
2021-04-01 10:13:11 +02:00
Gleb Popov
201510798c Add explanation for trick used in WhiteBoxTests::testTime()
Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I657586231eb7d7be344944c85b40eae9048931dd
2021-03-31 15:51:01 -04:00
Andras Timar
41c5cddc3d forward port packaging bits to master branch
The next version of Collabora Online will be version 2021.
Development of version 2021 will be carried on master branch
for the time being.
The corresponding core branch is distro/collabora/co-2021

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I9c97aaac711c9e1f1e48ed25066b169ea7e26e84
2021-03-31 18:29:49 +02:00
Gökay Şatır
7588255b3d CanvasSectionContainer: Add getter functions.
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I413c56a9d03236d733cb35636ba743ec49ce8400
2021-03-30 18:01:55 +03:00
Gökay Şatır
9cdcd61831 CanvasTileLayer: Add app.sectionContainer pointer.
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I4fef4b3544c1a356bf800da5983547ce29258055
2021-03-30 18:01:55 +03:00
Gökay Şatır
a15597de9c Merge GridLayer+TileLayer+CanvasTileLayer
Some of the functions were overwritten by the child classes. They are
removed.
CanvasTileLayer was experimental when we first created it. But now it's
used for all document types.

Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I1687c8d3e00d24a0bb2031ab74e4a3af044d9ca7
2021-03-30 14:36:05 +03:00
Gökay Şatır
86d3a3cd38 CanvasSectionContainer: Enable getTestDiv for all sections.
It wasn't usable when section is added by pushSection function.

Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I09a9db4fe27daad857f8f941606f0853e0e03399
2021-03-30 14:22:28 +03:00
Gökay Şatır
216cfbb6bd Remove extra check for positionOnMouseDown
We unintendedly solved the same bug with Szymon (while working on
different tasks), i removed the second
check.

Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: I33b22364b58036fb57809476ebc689d9b542b4bc
2021-03-30 14:22:28 +03:00
Miklos Vajna
c65d8e7c7f HttpRequest: add missing config.h include
fuzzers build was failing with:

	In file included from fuzzer/Admin.cpp:3:
	In file included from ./wsd/Admin.hpp:12:
	In file included from ./wsd/AdminModel.hpp:20:
	In file included from ./net/WebSocketHandler.hpp:18:
	./net/HttpRequest.hpp:667:31: error: expected ')'
		_header.add("Server", HTTP_SERVER_STRING);
				      ^
	./common/Common.hpp:62:51: note: expanded from macro 'HTTP_SERVER_STRING'
	#define HTTP_SERVER_STRING "LOOLWSD HTTP Server " LOOLWSD_VERSION
							  ^
	./net/HttpRequest.hpp:667:20: note: to match this '('
		_header.add("Server", HTTP_SERVER_STRING);
			   ^

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ibc3905e3e62e0eb9788b750971916ff4a4937f12
2021-03-30 12:23:09 +02:00
Gökay Şatır
ffd61d848f Move map._socket to window.app.socket
Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: Ia3f2b9d5d4516427d5b3b918cb4e5a503d9a79cf
2021-03-30 10:02:58 +03:00
Pedro Pinto Silva
c9b593741c Notebookbar: Improve shortcuts and fix top bar layout on tablet
- Desktop:
  - Shortcuts is now centered
  - Avoid setting hard min width for document title
- Tablet: Better presentation when on read only mode
  - Document name is now fully visible using all available space
  - Fix layout when on using tablet in portrait
  - When editing:
    - All top elements are now vertically centered
    - Document name uses better the available space
- Tablet: document-name-input: Fix shadow on iOS
  - Safari was overriding it with its own styles
- Generic:
  - Document name: do not use ellipsis if the text fits

when porting this please be sure that 81a5d029e was reverted first

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: I82abe930ba5e26c004b387fbf4047de8412b8a36
2021-03-29 09:34:35 +02:00
Pedro Pinto Silva
44f420fd01 Revert "NB shortcuts-bar vertical alignment update"
This reverts commit 81a5d029e0.

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
Change-Id: I8bfd3fec1d869be5ce0717091e27d59f6f331c25
2021-03-29 09:34:35 +02:00