From 2ec86e3b3ca70ccdc5a3fcd72a0808c30c2f3a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gu=CC=88nther?= Date: Wed, 7 Feb 2024 00:04:39 +0100 Subject: [PATCH 1/5] BUGFIX: Neos redirection issue in subfolder configuration Addressing an issue where the redirection to /neos fails when Neos runs in a subfolder. This commit introduces a new route to the defaultModule. The index action of the backend controller is responsible for ensuring the correct backend module. Additionally, consideration for the preferredStartModules configuration has been incorporated here. Fixes: https://github.com/neos/neos-development-collection/issues/4797 --- Resources/Private/Fusion/Backend/Root.fusion | 6 ++++++ packages/neos-ui-backend-connector/src/Endpoints/index.ts | 1 + packages/neos-ui-backend-connector/src/index.ts | 1 + packages/neos-ui-sagas/src/UI/Impersonate/index.js | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Resources/Private/Fusion/Backend/Root.fusion b/Resources/Private/Fusion/Backend/Root.fusion index 31aa049d0c..bf64bf3f08 100644 --- a/Resources/Private/Fusion/Backend/Root.fusion +++ b/Resources/Private/Fusion/Backend/Root.fusion @@ -232,6 +232,12 @@ backend = Neos.Fusion:Template { module = 'media/browser' } } + defaultModule = Neos.Fusion:UriBuilder { + package = 'Neos.Neos' + controller = 'Backend\\Backend' + action = 'index' + absolute = true + } } login = Neos.Fusion:UriBuilder { controller = 'Login' diff --git a/packages/neos-ui-backend-connector/src/Endpoints/index.ts b/packages/neos-ui-backend-connector/src/Endpoints/index.ts index 508d72075d..09aa39388a 100644 --- a/packages/neos-ui-backend-connector/src/Endpoints/index.ts +++ b/packages/neos-ui-backend-connector/src/Endpoints/index.ts @@ -43,6 +43,7 @@ export interface Routes { workspaces: string; userSettings: string; mediaBrowser: string; + defaultModule: string; }; login: string; logout: string; diff --git a/packages/neos-ui-backend-connector/src/index.ts b/packages/neos-ui-backend-connector/src/index.ts index 8b1cc854b8..afcdf77979 100644 --- a/packages/neos-ui-backend-connector/src/index.ts +++ b/packages/neos-ui-backend-connector/src/index.ts @@ -32,6 +32,7 @@ export const initializeJsAPI = (parent: {[propName: string]: any}, {alias = 'neo addLibrary('use', initializeUse(addLibrary, neos)); addLibrary('q', initializeFlowQuery(routes)); addLibrary('endpoints', initializeEndpoints(routes)); + addLibrary('routes', routes); // // Attach Neos API to the parent object diff --git a/packages/neos-ui-sagas/src/UI/Impersonate/index.js b/packages/neos-ui-sagas/src/UI/Impersonate/index.js index fd4e5af537..7a55fcf336 100644 --- a/packages/neos-ui-sagas/src/UI/Impersonate/index.js +++ b/packages/neos-ui-sagas/src/UI/Impersonate/index.js @@ -38,7 +38,8 @@ export function * impersonateRestore({globalRegistry}) { } else { yield put(actions.UI.FlashMessages.add('restoreUserImpersonateUser', errorMessage, 'error')); } - window.location.pathname = '/neos'; + + window.location.href = $get('core.modules.defaultModule', window.neos.routes); } catch (error) { yield put(actions.UI.FlashMessages.add('restoreUserImpersonateUser', errorMessage, 'error')); } From bf48d911d5076c58199b8865a93ef713e6faecf1 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 10 Feb 2024 09:40:31 +0100 Subject: [PATCH 2/5] TASK: Make `routes` available to middlewares Thanks for the idea @grebaldi --- packages/neos-ui-backend-connector/src/index.ts | 1 - packages/neos-ui-sagas/src/UI/Impersonate/index.js | 4 ++-- packages/neos-ui/src/index.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/neos-ui-backend-connector/src/index.ts b/packages/neos-ui-backend-connector/src/index.ts index afcdf77979..8b1cc854b8 100644 --- a/packages/neos-ui-backend-connector/src/index.ts +++ b/packages/neos-ui-backend-connector/src/index.ts @@ -32,7 +32,6 @@ export const initializeJsAPI = (parent: {[propName: string]: any}, {alias = 'neo addLibrary('use', initializeUse(addLibrary, neos)); addLibrary('q', initializeFlowQuery(routes)); addLibrary('endpoints', initializeEndpoints(routes)); - addLibrary('routes', routes); // // Attach Neos API to the parent object diff --git a/packages/neos-ui-sagas/src/UI/Impersonate/index.js b/packages/neos-ui-sagas/src/UI/Impersonate/index.js index 7a55fcf336..52fe8a2bd4 100644 --- a/packages/neos-ui-sagas/src/UI/Impersonate/index.js +++ b/packages/neos-ui-sagas/src/UI/Impersonate/index.js @@ -4,7 +4,7 @@ import {actionTypes, actions} from '@neos-project/neos-ui-redux-store'; import backend from '@neos-project/neos-ui-backend-connector'; import {$get} from 'plow-js'; -export function * impersonateRestore({globalRegistry}) { +export function * impersonateRestore({globalRegistry, routes}) { const {impersonateRestore} = backend.get().endpoints; const i18nRegistry = globalRegistry.get('i18n'); const errorMessage = i18nRegistry.translate( @@ -39,7 +39,7 @@ export function * impersonateRestore({globalRegistry}) { yield put(actions.UI.FlashMessages.add('restoreUserImpersonateUser', errorMessage, 'error')); } - window.location.href = $get('core.modules.defaultModule', window.neos.routes); + window.location.href = $get('core.modules.defaultModule', routes); } catch (error) { yield put(actions.UI.FlashMessages.add('restoreUserImpersonateUser', errorMessage, 'error')); } diff --git a/packages/neos-ui/src/index.js b/packages/neos-ui/src/index.js index 3e4491b15e..2a90c8556f 100644 --- a/packages/neos-ui/src/index.js +++ b/packages/neos-ui/src/index.js @@ -81,7 +81,7 @@ function * application() { // // Bootstrap the saga middleware with initial sagas // - globalRegistry.get('sagas').getAllAsList().forEach(element => sagaMiddleWare.run(element.saga, {store, globalRegistry, configuration})); + globalRegistry.get('sagas').getAllAsList().forEach(element => sagaMiddleWare.run(element.saga, {store, globalRegistry, configuration, routes})); // // Tell everybody, that we're booting now From f3105d03b7abc992baa8175a0eb5b47aaa092d2e Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 10 Feb 2024 09:46:48 +0100 Subject: [PATCH 3/5] BUGFIX: Use correct `defaultModule` route instead of hardcoded `/neos` --- packages/neos-ui/src/manifest.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/neos-ui/src/manifest.js b/packages/neos-ui/src/manifest.js index c456e89bb0..f64ddc0224 100644 --- a/packages/neos-ui/src/manifest.js +++ b/packages/neos-ui/src/manifest.js @@ -22,7 +22,7 @@ import initializeContentDomNode from '@neos-project/neos-ui-guest-frame/src/init import style from '@neos-project/neos-ui-guest-frame/src/style.css'; import backend from '@neos-project/neos-ui-backend-connector'; -manifest('main', {}, globalRegistry => { +manifest('main', {}, ({globalRegistry, routes}) => { // // Create edit preview mode registry // @@ -291,7 +291,7 @@ manifest('main', {}, globalRegistry => { // This is an extreme case when even the top node does not exist in the given dimension // TODO: still find a nicer way to break out of this situation if (redirectContextPath === false) { - window.location = '/neos'; + window.location.href = $get('core.modules.defaultModule', routes); break; } redirectUri = $get(['cr', 'nodes', 'byContextPath', redirectContextPath, 'uri'], state); @@ -360,7 +360,7 @@ manifest('main', {}, globalRegistry => { // This is an extreme case when even the top node does not exist in the given dimension // TODO: still find a nicer way to break out of this situation if (!redirectContextPath) { - window.location = '/neos'; + window.location.href = $get('core.modules.defaultModule', routes); break; } redirectUri = $get(['cr', 'nodes', 'byContextPath', redirectContextPath, 'uri'], state); From 120fd63d4c5db93277410414cad6dd93edac75e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gu=CC=88nther?= Date: Sat, 10 Feb 2024 19:58:59 +0100 Subject: [PATCH 4/5] BUGFIX: Load routes as they are defined in the bootstrap --- packages/neos-ui/src/manifest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/neos-ui/src/manifest.js b/packages/neos-ui/src/manifest.js index f64ddc0224..b4dce7d2d2 100644 --- a/packages/neos-ui/src/manifest.js +++ b/packages/neos-ui/src/manifest.js @@ -22,7 +22,7 @@ import initializeContentDomNode from '@neos-project/neos-ui-guest-frame/src/init import style from '@neos-project/neos-ui-guest-frame/src/style.css'; import backend from '@neos-project/neos-ui-backend-connector'; -manifest('main', {}, ({globalRegistry, routes}) => { +manifest('main', {}, (globalRegistry, {routes}) => { // // Create edit preview mode registry // From 9eb98a564e2030e44ee4210fb4cd312c88e8974d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gu=CC=88nther?= Date: Sat, 10 Feb 2024 21:01:51 +0100 Subject: [PATCH 5/5] TASK: Raise no_output_timeout for CircleCI --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0316a9e902..b0d11f17dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -108,7 +108,7 @@ jobs: - run: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash - run: chmod +x ~/.nvm/nvm.sh - run: - no_output_timeout: 20m + no_output_timeout: 30m command: | export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"