Commit graph

292 commits

Author SHA1 Message Date
Caolán McNamara
3d6838e300 serve wasm metadata
[ websrv_poll ] ERR  FileServerRequestHandler: File not found: Invalid URI request: [/browser/515f66e2bc/soffice.data.js.metadata].| wsd/FileServer.cpp:738

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6e4bb8a5a617f4ff8921430eae1f23147fd1a8cd
2023-12-11 19:28:18 +00:00
Ashod Nakashian
e836637aae wasm: wsd: coolwsd remembers disconnected mode preference
Switching to disconnected mode works.

Change-Id: I653b282af41bac483c76564fdcf72a83a79065e1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-12-09 19:22:24 +00:00
Ashod Nakashian
fd5c130d2d wasm: wsd: make switching wasm-only
Change-Id: I13386d60a469ec05c5b15369c32c5b3ccdffa232
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-12-09 19:22:24 +00:00
Caolán McNamara
5f1c943a98 add hasWASMSupport to capabilities
so the launching site can query if wasm is enabled to see if it needs to
insert the required headers, so we can then in turn make it optional on
those being set to also require matching headers.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Icd73081809abb8098c21bc61a8357869db45ff6c
2023-12-06 09:58:57 +00:00
Caolán McNamara
48002c5d40 allow testing wasm in non-debug mode
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I583a8104f590e26a76837bef00814684e2015c7a
2023-11-30 12:58:42 +00:00
Caolán McNamara
74b9c72814 need this even if we want to not serve wasm if the headers exist in richdocuments
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I310894e5a72002406eff77b07af76c2b048ffacc
2023-11-27 10:48:44 +00:00
Caolán McNamara
5232e3d735 hack to get this up and working
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6d3d273f59f58a0c3b2027039dcc7de95ad971b9
2023-11-27 10:48:44 +00:00
Ashod Nakashian
94d213c39e wsd: cache files that need no compression separately
Change-Id: I7b46becd330a7a09a05b7973b18c92679104f597
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-11-27 10:48:44 +00:00
Michael Meeks
7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Hubert Figuière
1114af585a default-ui: Allow skipping the UI state saved in local storage.
Pass SavedUIState=false to the ui_defaults

Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: I2cceffed338440d1fee5b0818e072ecc02379468
2023-11-08 10:12:42 -05:00
Michael Meeks
47b89b32ef spdx: improve machine and human readability of headers.
Change-Id: I1b6dcd2ec1fbef6556d70b8af3ccfd5d6a95c59a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-10-31 10:33:07 +00:00
Ashod Nakashian
8728cd5ea1 wsd: config cleanup and warning fixes
Change-Id: Idb66227d98f8fcca35307c3598a1fcc6b69e38c6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-26 20:31:45 -04:00
Ashod Nakashian
d9d13d7092 wasm: support serving wasm files
Updates README with instructions.

Change-Id: I5188d3ca267ff88a956dc17f302a70bda1046266
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Ashod Nakashian
184a4a522e killpoco: replace HTTPResponse in sendFileAndShutdown
We now use our http::Response in HttpHelper::sendFileAndShutdown.

Change-Id: I77503fce7a66a11435bad896d3d5d6df611544be
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Ashod Nakashian
6ed5dc9a64 wsd: http: no need to pass the mime-type explicitly to sendFile
Since we already have an http response instance (in all but
one case, prior to this change), there is no need to pass
the mime-type explicitly to the sendFileAndShutdown
function, only to set it on the http response.

There are already too many arguments and the mime-type
is surely redundant.

Change-Id: Iab64074dc111573b87fb8fa9b907c26a4160910c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Ashod Nakashian
0c59eda780 wsd: http: use named HTTP status-code instead of naked int
Self-documenting, less error-prone, and searchable.

Change-Id: Ifc21d7cf5512d9a63c5d5bc10ebc003fcccc93c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Caolán McNamara
6c67b072fa cid#318855 Unchecked return value from library
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9572414e3cfc8426ca6b25872231470f072c5aad
2023-10-20 08:25:07 +02:00
Rash419
11a0e78ed4 admin:log activities irrespective of logging.level
- It logs activities like when admin logged in, authenticated
  metrics endpoint accessed, external monitor getting connected
  and admin actions like kill the document etc

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I059f6b6ee0d8269aec7e3f521622773e348304a3
2023-10-17 14:57:10 +05:30
Caolán McNamara
724c0ca7a6 cid#318860 Unchecked return value from library
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I765e71d76ff4be8ef7a92b060af026e3c26f669b
2023-10-16 09:37:01 +02:00
Ashod Nakashian
96bc73ea17 wsd: simpler string appending in readDirToHash
Change-Id: I13c741bd5cae3cfe4ffb1a71ddc2de650356ac4b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 19:29:12 -04:00
Ashod Nakashian
4bf309d136 killpoco: serve the Welcome file using http::Response
Change-Id: Ia29a881f8ec53aa1d48c20240ecc0e01b58ef2b6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 19:29:12 -04:00
Ashod Nakashian
7aed4c0461 wsd: const correctness
Change-Id: I1be6a2055d906b590d7801f9873a48d510c78a0b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 19:29:12 -04:00
Ashod Nakashian
d2ebd4cff7 wsd: FileServerRequestHandler instance
This encapsulates and manages the lifetime of
file-serving cache in an instance of
FileServerRequestHandler. Previously, it was
all done through static functions and explicit calls.

Change-Id: I1b0bf0e3c25e6ae82c398bf5d0de255a6fec42a1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 19:29:12 -04:00
Rash419
c9e7591add clusteroverview: send routeToken with auth message
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I6412d68ef0c86d7a618eaf0ad252c16dee565d77
2023-08-18 23:27:04 +05:30
Ashod Nakashian
a42adac98f wsd: add the web-server URL to the media-src list
We need to allow loading media sources from
the web-server URL. This seems to be necessary
at least on iOS.

Change-Id: Ic7b23c4f80b975460de9311a67f3c5cb51758d14
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-10 12:24:08 +02:00
Henry Castro
a2b924033d admin: rename ACCESS_TOKEN -> JWT_TOKEN
To avoid confusion with the WOPI access token.
.

Change-Id: Ie38e0f11d0655e89eb1c7f1e20b73a9b8756ba21
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-08-08 08:27:30 -04:00
Rash419
0ed983d7a3 admin: refactor adminClusterOverview.js
- refactored special case for templating
  adminClusterOverview.html
- removed useless variable
- format the code, fix indent

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ib22cb481db7c7ef94b11f3044d0cd856e6d0eed5
2023-08-05 14:28:29 +05:30
Rash419
944f269926 admin: added new cluster overview page
- added DlgLoading class to show loading modal dialog
- upgraded the d3

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I8bd99bbadaa59a7de1e83bebde8db0dce920705d
2023-08-05 14:28:29 +05:30
Rash419
fc77e1a1ff admin: fix auth issue when switching between
multiple cool servers
- also good to check response first as client
  might use persisted cookies

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Idcd85266a4cc5020aeaca7d7fb8428bc0a3d7d32
2023-08-04 21:25:37 +05:30
Caolán McNamara
8bb41ee775 cid#318947 Unchecked return value from library
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia8b96035d5038d82a55f68a751fdbda5806ec1d6
2023-08-04 10:17:58 +02:00
Ashod Nakashian
5b52f7d8eb wsd: smart pointer cleanup
std::make_shared and std::make_unique
are superior to explict smart pointer
construction. Where we have private
constructors, we can't use them.

Change-Id: I492122f58e958113c6e6d31445c6614ad98c89aa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Ashod Nakashian
b8854ea2e9 wsd: decouple FileServerRequestHandler from COOLWSD
Change-Id: Ie121849a16bb84195d32e11a67e4aad5753aebfc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Ashod Nakashian
d47001267b wsd: reduce manual http header creation
We have http::Response specifically for
this kind of thing.

Change-Id: I57130754f95c06f5ab958ca373f21763e74cb6a2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-08-03 08:40:20 +02:00
Henry Castro
47485adc3e admin: add access token
The access token will validate the session
when a websocket is connected to the server.

Change-Id: I008b04a499ab0d85fd6f95fc06a511f800c0bb2e
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-08-02 20:23:42 +01:00
Pranam Lashkari
fb5909bc40 theme: use integration theme value from the interation message
problem:
till now we used values from DOM elements which were unreliable,
sometimes they are not discoverable due to nested iframs.
That threw some 404 due to incorrect theming path.

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Ibc291ce9f64db799095e1edcb14c598bdd085de7
2023-07-24 10:06:35 +02:00
Michael Meeks
b963cde3c7 FileServer::LocalFileInfo re-work local file-list management.
Calling a PUT before a GET would cause a SEGV around managing the
internal list of files.

Re-factor to ensure we always have a valid LocalFileInfo to
work with, and simplify and cleanup code-paths.

Change-Id: I2b206bb8bdebc3c44cd55c61048da9b0dc30dbd5
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-08 13:08:59 +01:00
Henry Castro
e5b4036627 wsd: fix secure cookie Set-Cookie
The browser will block the cookie if it is sent
over an insecure connection

"This attempt to set a cookie via a set-cookie header was
blocked because it had the "Secure" attribute but was not
received over a secure connection."

Change-Id: I36faac0d9d3a73eed463c2580e5405d61a3a18f5
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-06-29 20:47:08 +01:00
Szymon Kłos
722d538d15 Pass ui_theme to welcome dialog
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I19270ad653540b72f5606554848eed88bded8333
2023-06-23 08:15:35 +02:00
Caolán McNamara
5064d2bff1 cid#318846 Array compared against 0
array_null: Comparing an array to null is not useful: "false",
since the test will always evaluate as true.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib34694022484e9041827980c0b67fe614446f4b9
2023-06-21 11:11:42 +02:00
Ashod Nakashian
7a634d0790 wsd: support providing CSP header in the config
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 25fe0b2dfb56494d59c3502f690265d46dbbc4ff)

Change-Id: I3e1f3085846ab31326a0a788e7332b5332c10c94
2023-06-19 07:45:02 -04:00
Ashod Nakashian
df898ae3a3 wsd: more CSP refactoring
Change-Id: Id7a31fbd2e804de758abb31ebb32e419a2955194
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit c1b19c0ae6b5148dee1517dfce19de5cfa27b9d5)
2023-06-19 07:45:02 -04:00
Ashod Nakashian
cefc71b198 wsd: add ContentSecurityPolicy manager
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 995c24345eeedc7cbd9e81f9b6c151e79b695fdc)

Change-Id: I75d6da58019d218a121bdf7bc72e73dd0f320216
2023-06-19 07:45:02 -04:00
Ashod Nakashian
fa3887ad4a killpoco: replace URI::encode with our wrapper
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 3e8deb33c6459634a6ce111bfa1d01f21f04a30a)

Change-Id: I959e7943ec291f04c03237f9550ccaecf5a81aa7
2023-06-19 07:45:02 -04:00
Ashod Nakashian
d221ac276b wsd: simplify frame-ancestor handling
Change-Id: I1ae8443a8a09b485a89b69a2d25d2efc49c34a52
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit c317090f4c9ba4fa1a5521bc5b31a48dfafd2516)
2023-06-19 07:45:02 -04:00
Marco Cecchetti
39be94e852 Force notebookbar ui when a11y is enabled
When accessibility is enabled in coolwsd.xml, overrides setting in
<user-interface> section by force to use the notebookbar UI.

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I98f4b288439b21110214ca2a67df639b397184c9
2023-06-15 08:54:51 +01:00
Caolán McNamara
2e38ab907c cid#318943 Uninitialized scalar variable
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I4b5afe9f26f90c11aec6009c55a9438263cff4e4
2023-06-14 10:10:46 +02:00
Marco Cecchetti
d01bedc09c a11y: add config for enable/disable accessibility in general
A new section about accessibility has been appended to coolwsd.xml
config file

Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I086abdf73646639283eb655ae60f200fb64e495a
2023-06-08 00:00:51 +02:00
Julius Härtl
752cde163e feat: Add UITheme option for light/dark to ui_defaults
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Change-Id: Ief028dcec0daa2ae448f83df993e0e5ade594a7c
2023-06-01 09:49:08 +02:00
Gökay Şatır
9d6296e4b3 Remove unused document signing code.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I30cf381d1fa282cf222ab5abc676374ab7eefb6c
2023-05-08 21:51:47 +03:00
Henry Castro
0db06a8679 wsd: include CSP server host to ...
load using script interfaces.

There is use case such reverse proxy uses another domain
to request the l10n json resources, but the CSP Chrome triggers:

l10n.js:62 Refused to connect to 'http://192.168.0.2/localizations.json' because it violates the following Content Security Policy directive: "connect-src 'self' ws://192.168.0.1:9980".

request_JSON @ l10n.js:62
String_ctr.<computed> @ l10n.js:85
(anonymous) @ l10n.js:263
(anonymous) @ l10n.js:286
l10n.js:62 Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://192.168.0.2/localizations.json'.

Change-Id: I57fff24c00adebdf7dd06929d6341ea14554a6d2
Signed-off-by: Henry Castro <hcastro@collabora.com>
2023-04-28 06:30:57 -04:00