From 467dff8abccb0cae313652f75c30e7e8e1d728b3 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Wed, 28 Feb 2024 18:03:31 +0100 Subject: [PATCH 1/5] fix(patchers): handle initial state for non-existing app Signed-off-by: Grigorii K. Shartsev --- src/patchers/@nextcloud/initial-state.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/patchers/@nextcloud/initial-state.js b/src/patchers/@nextcloud/initial-state.js index d236872b..79e63bb2 100644 --- a/src/patchers/@nextcloud/initial-state.js +++ b/src/patchers/@nextcloud/initial-state.js @@ -84,8 +84,8 @@ function getInitialStateFromCapabilities(capabilities, userMetadata) { // eslint-disable-next-line jsdoc/require-jsdoc export function loadState(app, key, fallback) { const capabilities = getInitialStateFromCapabilities(appData.capabilities, appData.userMetadata) - const elem = capabilities[app][key] - if (elem === null) { + const elem = capabilities[app]?.[key] + if (elem === null || elem === undefined) { if (fallback !== undefined) { return fallback } From 29bebee474eaec9e419603d00bb19a3b4fb552c8 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Wed, 28 Feb 2024 18:04:22 +0100 Subject: [PATCH 2/5] fix(patchers): don't delete requesttocken header Signed-off-by: Grigorii K. Shartsev --- src/patchers/@nextcloud/axios.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/patchers/@nextcloud/axios.js b/src/patchers/@nextcloud/axios.js index 534e508c..b00b6f4d 100644 --- a/src/patchers/@nextcloud/axios.js +++ b/src/patchers/@nextcloud/axios.js @@ -23,7 +23,6 @@ import axios from '@desktop-modules--@nextcloud/axios' axios.interceptors.request.use((config) => { config.withCredentials = true - delete config.headers.requesttoken config.headers['OCS-APIRequest'] = 'true' return config }, (error) => Promise.reject(error)) From faf45950d37015a6c7fbb70c46cee5c343df1beb Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Wed, 28 Feb 2024 18:05:01 +0100 Subject: [PATCH 3/5] fix(app): allow SEARCH and REPORT requests Signed-off-by: Grigorii K. Shartsev --- src/app/webRequestInterceptor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/webRequestInterceptor.js b/src/app/webRequestInterceptor.js index fc80faba..802a9568 100644 --- a/src/app/webRequestInterceptor.js +++ b/src/app/webRequestInterceptor.js @@ -81,7 +81,7 @@ function enableWebRequestInterceptor(serverUrl, { } const ALLOWED_ORIGIN = [process.env.NODE_ENV === 'production' ? 'file://' : `${DEV_SERVER_ORIGIN}`] - const ALLOWED_METHODS = ['GET, POST, PUT, PATCH, DELETE, PROPFIND, MKCOL'] // Includes WebDAV + const ALLOWED_METHODS = ['GET, POST, PUT, PATCH, DELETE, PROPFIND, MKCOL, SEARCH, REPORT'] // Includes WebDAV const ALLOWED_CREDENTIALS_TRUE = ['true'] const ALLOWED_HEADERS = [[ // Common From 0260d22969685505a3406eff045bfd5db8ad1089 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Wed, 28 Feb 2024 18:15:59 +0100 Subject: [PATCH 4/5] fix(app): allow X-Requested-With header Signed-off-by: Grigorii K. Shartsev --- src/app/webRequestInterceptor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/webRequestInterceptor.js b/src/app/webRequestInterceptor.js index 802a9568..3bc1a7df 100644 --- a/src/app/webRequestInterceptor.js +++ b/src/app/webRequestInterceptor.js @@ -90,10 +90,11 @@ function enableWebRequestInterceptor(serverUrl, { 'If-None-Match', // WebDAV 'Depth', - 'requesttoken', // Nextcloud + 'requesttoken', 'OCS-APIRequest', 'X-OC-MTIME', + 'X-Requested-With', ].join(', ')] const EXPOSED_HEADERS = [[ // Common headers From 0a7b16882e61bb424627405e6f2e2fd8c886db0f Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Wed, 28 Feb 2024 18:06:34 +0100 Subject: [PATCH 5/5] chore(README): remove "Share from Nextcloud" from unsupported features Signed-off-by: Grigorii K. Shartsev --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ef8b1738..a9b1a2f4 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ - Currently not supported: - Screen sharing ([#11](https://github.com/nextcloud/talk-desktop/issues/11)) - - Share from Nextcloud (including files creation) ([#12](https://github.com/nextcloud/talk-desktop/issues/12)) - Contacts menu on user avatars menus ([#34](https://github.com/nextcloud/talk-desktop/issues/34)) - Setting User Status ([#26](https://github.com/nextcloud/talk-desktop/issues/26)) - Search ([#30](https://github.com/nextcloud/talk-desktop/issues/30))