Commit Graph

282 Commits (master)

Author SHA1 Message Date
Caolán McNamara ff02af21d3 add Async DNS implementation
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I577af4280ac5a0a4389bb11ac6c531d846a196d1
2024-05-17 19:47:09 +01:00
Miklos Vajna 0ef5e740a4 fuzzer, clientsession: fix build
Probably went wrong in commit de985834e2
(wsd: simplify DocumentBroker construction, 2024-04-03).

Also init logging to avoid:

common/Log.cpp:664:16: runtime error: downcast of address 0x6070000005d0 which does not point to an object of type 'GenericLogger'
0x6070000005d0: note: object is of type 'Poco::Logger'

similar to how COOLWSD::innerInitialize() does it.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ic16bb2f070e1f0e12204bcc2fc70303d8c1250c8
2024-05-13 08:29:07 +01:00
Michael Meeks ebb4eda3df Move common/MessageQueue.cpp -> kit/KitQueue.cpp.
This is not common code, it's used only in the Kit.

Rename TileQueue -> KitQueue as well as unhelpful member variable naming.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If158597f99f302cbc27e8eab139972f57a2fc3bb
2024-05-09 09:50:08 +01:00
Caolán McNamara ca2ca25d07 try rm -f coolwsd instead of rm coolwsd
Making check in .
make[1]: Entering directory '/home/collabora/jenkins/workspace/github_online_master_debug_vs_co-24.04'
fatal: ref HEAD is not a symbolic ref
Cleaning up...
/bin/sh: ./coolwsd: No such file or directory
rm: cannot remove './coolwsd': No such file or directory
make[1]: *** [Makefile:7155: /home/collabora/jenkins/workspace/github_online_master_debug_vs_co-24.04/jails] Error 1
make[1]: *** Waiting for unfinished jobs....

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I31748354bb55f26a8a5b8475a4daa74b3ba5d729
2024-05-07 15:12:55 +01:00
Aron Budea 246e87fea2 wsd: Unconditionally compile support-key-enabled code paths
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Iec477c223f2dc75e0be8b472c8439ca9311d6aae
2024-04-14 01:23:00 +01:00
Hubert Figuière 7a9aa6c6c9 Makefile: added a target to run with heaptrack
It will launch the gui at the end if found
It's much faster than valgrind+massif

Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: Ied5a00ab634f78bbb0dd24a48a83ae4293183cd4
2024-04-10 15:54:56 +02:00
Michael Meeks 144b701453 cool#8703 - Drop random node creation and rely on inherited fd.
Re-using an inherited file descriptor to /dev/urandom frees us
from problems with mount options including 'nodev' and removes a
capability from the set we need.

Change-Id: I70337e923f802d7efbd3159c11a4e39f6529b6e6
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-04-07 12:11:48 +02:00
Michael Meeks 29ef73868f killpoco: avoid using Poco::Random which likes /dev/random.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I34659b3fda8a22a1b34416a37e18f483d7961f5e
2024-04-07 12:11:48 +02:00
Ashod Nakashian fe3c3bc135 wsd: test: move WebSocketSession under test
WebSocketSession is used exclusively for tests,
so it's best that it is located in the test
directory.

Change-Id: I88333d619902df7991c3f26b94ed309246446ae0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-21 09:08:51 +00:00
Jaume Pujantell 3ba713aabf add isMobileApp util function to reduce ifdefs
Removed all MOBILEAPP preprocessor conditionals from Util.hpp/.cpp
Added isMobileApp function to help remove further conditionals.

Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I038a4db47ec2a2c7bb10f5696df5571b13bd9a61
2024-03-20 09:13:00 +01:00
Michael Meeks c1b6b5d30f Watchdog to call probe-point when SocketPolls are slow.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Id58efab0c0fee88a3da094765eb6b7641aec6e02
2024-03-19 11:29:07 +00:00
Henry Castro db8fee7d9b browser: create 'prettier-write' rule
Change-Id: I3f326da9428e4c8c5558912004446725f6b32772
Signed-off-by: Henry Castro <hcastro@collabora.com>
2024-03-12 13:49:38 -04:00
Henry Castro 20462e576f browser: create prettier rule
Change-Id: I8ea727458c450a14880b06971d48c58edd0961c2
Signed-off-by: Henry Castro <hcastro@collabora.com>
2024-03-12 13:49:38 -04:00
Henry Castro e2103b241a browser: create eslint rule
Change-Id: I65766ffdebf5c3148cf13507f6ee9c1980c4bb79
Signed-off-by: Henry Castro <hcastro@collabora.com>
2024-03-12 13:49:38 -04:00
Michael Meeks 04b74d5767 Initial RLE benchmark.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I00a7903fe9b10066881b1637f6ae9ad59ff6607b
2024-03-10 20:06:53 +00:00
Ashod Nakashian dacfb65965 wsd: move WopiStorage to own home
Change-Id: I622c6c1230f7c1248c7b432b6d1b56bff4cacb9e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-09 12:37:19 -05:00
Ashod Nakashian 11422c5340 wsd: move WopiProxy to wopi/
Change-Id: I5ec7bfe1c5295c3d17979dc5aaa2806259c6af9d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-09 12:37:19 -05:00
Neil Guertin f82915ebcb Move kit pid helper functions to one file
Signed-off-by: Neil Guertin <neil.guertin@collabora.com>
Change-Id: If77b8ac3c7493f4d44b510ec54b68292856f89d5
2024-03-09 16:36:39 +00:00
Skyler Grey a40be5499e Add prettier
Prettier is a code formatter for javascript/typescript. It's relatively
common to see complaints about style in pull requests or inconsistent
style getting in to Collabora Online. Also, without a formatter it's
harder for editors to automatically format code in sensible and
consistent ways

Prettier doesn't have many options, but those which it does have I have
set to the closest values to current behavior (e.g. single quotes) in
order to minimize unnecessary changes

This commit doesn't format all existing files. Doing so would cause
blames, cherry-picks and diffs to become much less useful. Instead, we
use browser/.beforeprettier to list all files that would need to be
changed, and this file is ignored. You are encouraged but not required
to set your editor's equivalent of 'editor.formatOnSaveMode' to only
format changed lines

This commit also does format of docstatefunctions.js, previously it did
not in to check that an incorrectly-formatted file could fail CI. Now it
does to make sure that formatting fixes the issue. This file was chosen
because it is very new and very small.

Change-Id: Ie6067f34aa658f887e149a08aebd0180b2354005
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
2024-03-09 15:53:21 +01:00
Michael Meeks c117d87bb4 nearly pure re-factor: split out code into its own modules.
StateRecorder.hpp split from ChildSession.cpp
KitWebSocketHandler.[ch]pp split from Kit.cpp.
ThreadPool.hpp split from RenderTiles.hpp

Expose headers for KitSocketPoll and Document
at the same time.

Not clear we need the DocumentManagerInterface anymore.

Conditionally compile out Document::createSession for unittest
dependency breaking, and avoid Rlimit::handleSetrlimitCommand
likewise.

Make makePropertyValue a private method of Kit.cpp.

clang-format new files.

Change-Id: I47a1d6afe20165f156b477a931b94c916cff4b9d
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-03-06 20:56:55 -05:00
Ashod Nakashian 7b0d87e47c wsd: move StorageConnectionManager into wopi
Change-Id: I1d606f1ccf0c9bc95dfc8b0fa88d082f2c123127
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-05 07:10:34 -05:00
Ashod Nakashian 317397eaac wsd: new CheckFileInfo class to do async requests
We also create a new sub-directory for WOPI
code, which helps better organize things and
isolate it from Mobile App builds, which have
no need for it.

Change-Id: Id6dbbd450f35c9c0eb8460de12330cff2e3e5576
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-05 07:10:34 -05:00
Andras Timar b922c3446f Add THIRDPARTYLICENSES file
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I16d35e8b5de011320578a976d870d09cfcb4d6e6
2024-02-27 08:59:46 +00:00
Andras Timar 5288efbe91 Remove obsolete init script
The baseline is EL7, and systemd is assumed.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ibc43996e8b23007876ee8fa0d7dcf8478b217aa0
2024-02-23 09:34:47 +00:00
Ashod Nakashian 5a82c36680 wsd: move ClientRequestDispatcher to own file
This moves ClientRequestDispatcher and all
its direct exclusive dependencies to its
own file and adjusts formatting.

No functional changes were performed,
although namespaces were restored and
other minor changes were done for
consistency.

The resulting file is still rather large
at around 2000 lines, but that makes
COOLWSD.cpp smaller by about 30% now.

Change-Id: I59bcd997ad08702ce7029c6791095e75ad9b23b0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-21 20:13:39 -05:00
Michael Meeks 720ac3d5a6 check: perform simple & quick eslint check before others.
Should save time in CI for simple JS errors.

Change-Id: Ib7e1ab68795cab12f8f5ec461cfed6e84986f440
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-02-07 17:13:48 +00:00
Ashod Nakashian 5c5c4559f9 wsd: rvs: add RequestVettingStation
RequestVettingStation is designed to
vet requests before allocating further
resources. Specifically, it is to be
used to verify whether the resource
requested exists and whether or not
the request is allowed and authenticated.

All of this is designed to be done
asynchronously, for performance reasons.

Change-Id: I399fa7bc91741ffee065a6d41acca0756eedc939
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 18:59:18 +00:00
Skyler Grey 1adece89d6 Make eslint in make check fail on eslint warnings
As discussed [on Matrix](https://col.la/suppresseslintindevelopment) the
set of things we want to pick up in CI and development are different.
Specifically, there are some things that only get in the way during
development but should not be allowed in merged code. Examples are
'debugger' statemens, dead code (e.g.  resulting from 'if (false)') and
unused variables.

After #7822 there are no more eslint warnings, so we can use it as a
separate state for these issues that should only block in CI.

This commit make make check run eslint and fail if it receives any
warnings, and changes those 3 errors so that they only emit warnings.

It's expected that there are more annoying warnings which I've missed,
if you have any please make a followup change!

This commit explicitly does not deal with formatting-related
issues (e.g. requiring single quotes for strings in eslint) as though
they can be annoying there's no reason why they should change between
development and master... another followup to improve linting experience
could be to use an autoformatter so the computer fixes the formatting
for you, however that's out-of-scope for this commit

Change-Id: I036afac5ef5056a9cc2effc21e31165aa1436ad2
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
2023-12-19 20:25:43 +00:00
Jaume Pujantell 1ce9f834a0 added coolwsd-inproc executable
Added build rules for coolwsd-inproc and some run command to use it.

Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I4138ff7337bc354b0221070105dd34ea9ef19691
2023-12-18 10:34:10 +00:00
Jaume Pujantell 8f178ef6cd extract some functions to extra files for in process mode
Extract some functions from ForKit.cpp and COOLWSD.cpp to new files
so we can do a kit in process mode without using ifdef directives.

Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I7529f8f46a8026318244666b27d1ce72ed5ad4ca
2023-12-18 10:34:10 +00:00
Ashod Nakashian 0631593c96 wasm: proxy wopi documents
Change-Id: I3104ac9a6fd180f11aef06b9d4f516a392e021a9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-11-27 10:48:44 +00:00
Ashod Nakashian a624a704ac wsd: add StorageConnectionManager
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>
2023-11-27 10:48:44 +00:00
Miklos Vajna a0944a0b5e Fix the --enable-fuzzers build
Failed with:

	fuzzer/HttpEcho.cpp:111:17: error: 'removeSockets' is a private member of 'SocketPoll'

And:

	kit/Delta.hpp:208:(.text._ZN14DeltaGenerator14DeltaBitmapRow7initRowEPKjj[_ZN14DeltaGenerator14DeltaBitmapRow7initRowEPKjj]+0x127): undefined reference to `simd_initPixRowSimd'

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I6d980698b43ca3545d9eae5f40eabaf4e442ca17
2023-10-02 20:15:42 +01:00
Caolán McNamara 5c5e1c41d6 use spaces instead of tabs
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3c7c474d10e500d662fc0e697f8e2b298799d795
2023-09-25 16:55:04 +01:00
Caolán McNamara 42e98bb2e4 experimentally bootstrap something using avx2 to generate bitmap
just enough to get the same results as before

https://github.com/CollaboraOnline/online/issues/7165

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I109c9b8f1e7935782c72e0179aa0ed48712eadb6
2023-09-25 16:55:04 +01:00
Michael Meeks cce3767ba8 First cut SIMD wrappers / separation to accelerate RLE code.
Split it out as a C file, to avoid accidental C++ header inclusion,
and C is a cross-platform assembler anyway so a good match.

Change-Id: I6c042781713aecaf143b9663af8377659a7deaf1
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-09-25 16:55:04 +01:00
Ashod Nakashian fbc4373ceb gcov: support cleaning coverage data and document
Change-Id: I9d309a9e551f2a110b71c773af10e65b60c07c9c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Andras Timar fc946198d3 Rewrite coolwsd-generate-proof-key in C++
* simplified the tooling a bit: use coolconfig for creating
  RSA key pairs for WOPI Proof headers.
* got rid of a dependency: ssh-keygen, towards leaner docker images

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Iaf468b5c8585d45027f512bb0a287ab77afb1ea9
2023-07-22 00:14:48 +02:00
Caolán McNamara 2c99a097b2 fail make check early in typical dev setup if core not built using --without-system-nss
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Idcf86a7b488e08d59a944a96f17072a7a7a72b3f
2023-07-04 21:30:34 +01:00
codewithvk 2dcabfd3ca Condense common parameters in Makefile
Change-Id: Ic39a90bf263504bb45b0b933e06893629966e357
Signed-off-by: codewithvk <vivekpatel7202@gmail.com>
2023-06-29 11:39:18 +01:00
Ashod Nakashian cefc71b198 wsd: add ContentSecurityPolicy manager
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 995c24345e)

Change-Id: I75d6da58019d218a121bdf7bc72e73dd0f320216
2023-06-19 07:45:02 -04:00
Ashod Nakashian 9e8238310c make: failing jail cleanup is not fatal
In some cases jail cleaning up may fail.
In such a case, we still want to be able
to build a fresh set of binaries, which
are used to run coolwsd --cleanup.

Since cleaning up the jails and the
systemplate are not strictly required
to building, we now only emmit a warning
and move on.

Change-Id: I4ebf7772cf767b579810247c427d86efa5a6d3ad
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-19 07:45:02 -04:00
codewithvk 71039cb0e4 Condense common parameters in Makefile.am
Signed-off-by: codewithvk <vivekpatel7202@gmail.com>
Change-Id: Ie3027c63cc31eea2dea2cb0a997d296a24476581
2023-06-03 14:55:58 +01:00
Ashod Nakashian c6dd263ab1 make: silence clang complaining of -pthread
The clang linker doesn't need -pthread and
warns of unknown command-line option.

This detects clang and forgoes the -pthread
flag to the linker.

Change-Id: I658cd887c567a5beeeae0e6e1b6d596231894c1b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Andras Timar 39e83470a8 Remove distro-specific code from rpm spec file
We'd like to build distro independent rpm packages.
Distro specific macros and other code were removed.
The empty environment file for systemd was removed, it can be
easily created by the user, if necessary.
The obsolete trigger for rebuilding the systemplate was removed,
because we no longer copy system libs to systemplate.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I0ac9be8f72a7089e38349abc1dff0d39b0410e44
2023-05-14 21:29:00 +02:00
Ashod Nakashian d8d88c740d make: generate compile_commands.json for all .cpp files
Best to have all .cpp files in compile_commands.json
so they can all benefit from the tools that leverage
it. So now we recursively generate the file for all
.cpp files in all subdirectories. Most notably, now
all test files are included.

Change-Id: I312d812463607b32fe6b9e83b10900c17ae86185
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-02 19:54:31 -04:00
Andras Timar 48a1101970 add common/LangUtil.hpp to distribution
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ic7ad5f7a75cab91d7f34d1455737a8838564c502
2023-03-14 23:37:19 +01:00
Andras Timar e23bb604b8 add OPENSSL_CFLAGS to include path when SSL is enabled
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I1a65f15bd8bfa7a25e368fa54c62fd8f06a3bd8a
2023-02-26 18:50:58 +01:00
Tor Lillqvist 01953730f2 Do build also the browser dir in the (quick-and-dirty) Emscripten case
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ibe7782c8dadd232b4ee4f2f9585e0649d4eb71f1
2023-01-16 18:43:21 +02:00
Tor Lillqvist 1889fe2016 When we are building WASM we don't build the browser subdirectory
This is how I imagine that this stuff should work:

- In one tree you build with --host=wasm32-local-emscripten. This
  results in only the WASM binary being built, containing C++ code
  from Collabora Office core and C++ code from Online (to a similar
  extent as in the iOS, Android, and gtk apps). No HTML and JS for the
  client's browser is produced in this tree. The embedded filesystem
  from the corresponding WASM core build could be copied into this
  tree for use as below. (Or, alternatively the build in the other
  tree could look into the config.status file in this tree to figure
  out where to pick up the embedded fs data file.)

- In another tree you build with --with-wasm-fallback=<path to the
  above WASM tree>. Note that the C++ code will be built normally in
  this case, for Linux. This build results in an otherwise normal COOL
  build, with the added feature that the COOL server sends the whole
  document file also to the COOL client whenever it is saved. The HTML
  and JS browser code will have code that enables receiving the
  document in this case, plus incremental updates to the document (if
  possible), and code to detect that the connection to the COOL server
  is broken and then fall back to using the local WASM in the
  browser. Obviously the WASM binary and related JS and other data
  (like the embedded file system from core) will have to be downloaded
  into the client right at the start, to be present if the connection
  breaks, but the WASM will likely not need to be started until
  needed.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I945c93451d3f5f0b1bc6ad8550da64e8e6453b6b
2023-01-15 19:46:37 +01:00