Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for running the Luna SPA under an arbitrary site URL prefix (e.g. /prefix/luna/) by centralizing base-path handling and updating hard-coded URLs throughout the app.
Changes:
- Introduces a shared path utility (
@app/utils/path) to compute/apply the site prefix, app base, UI base, and endpoint URLs. - Updates navigation, iframe URLs, API calls, and login redirects to use the new prefix-aware helpers.
- Adds runtime base-href initialization in
index.htmland adjusts Angular/dev-server configuration to align with/luna/serving.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/typings.d.ts |
Adds Window globals used for runtime base-path injection. |
src/index.html |
Computes prefix from location.pathname, sets __BASE_PATH__/__UI_BASE__/__LUNA_BASE__, and updates <base href>. |
src/app/utils/path.ts |
New helper module for prefix/base URL resolution and joining (site/app/ui/endpoint/ws). |
src/app/utils/common.ts |
Uses withAppBase for the connect URL opened in a new page. |
src/app/services/http.ts |
Prefixes same-origin API URLs via resolveUrl() and makes login redirect next prefix-aware. |
src/app/services/connect-token/acl-dialog/acl-dialog.component.ts |
Uses withUIBase for profile link. |
src/app/services/app.ts |
Makes login redirects and router navigation prefix-aware (uses getAppRoutePath, withSitePrefix). |
src/app/pages/share/share.component.ts |
Uses withSitePrefix for share iframe URLs. |
src/app/pages/sftp/sftp.component.ts |
Uses withSitePrefix for SFTP iframe URL. |
src/app/pages/monitor/monitor.component.ts |
Uses joinEndpointUrl to build monitor iframe URLs correctly under a prefix. |
src/app/pages/main/main.component.ts |
Uses toAbsoluteWsUrl for WebSocket URL and withAppBase for replay-path detection. |
src/app/pages/kubernetes/kubernetes.component.ts |
Uses withSitePrefix for k8s iframe URL. |
src/app/elements/nav/profile/profile.component.ts |
Uses withSitePrefix for logout redirect. |
src/app/elements/nav/nav.component.ts |
Uses withSitePrefix/withUIBase for external navigation links. |
src/app/elements/content/content-window/koko/koko.component.ts |
Uses joinEndpointUrl for koko-related iframe URLs; base URL handling adjusted. |
src/app/elements/content/content-window/default/default.component.ts |
Uses joinEndpointUrl for connector iframe URLs. |
src/app/elements/connect/download-dialog/download-dialog.component.ts |
Uses withSitePrefix for the download link. |
src/app/elements/chat/chat.component.ts |
Uses withUIBase for chat iframe URL. |
src/app/app.module.ts |
Makes translation endpoints/assets prefix-aware and sets APP_BASE_HREF from getAppBasePath. |
package.json |
Updates ng serve scripts to serve from /luna. |
Dockerfile |
Updates the build base image tag. |
angular.json |
Sets build baseHref and dev-server servePath to /luna. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const currentPath = encodeURI(document.location.pathname + document.location.search); | ||
| const loginUrl = new URL(withSitePrefix('/core/auth/login/'), document.location.origin); | ||
| loginUrl.searchParams.set('next', currentPath); | ||
| setTimeout(() => { | ||
| window.location.href = document.location.origin + '/core/auth/login/?next=' + currentPath; | ||
| window.location.href = loginUrl.toString(); | ||
| }, 500); |
There was a problem hiding this comment.
gotoLogin() pre-encodes currentPath with encodeURI(...) and then passes it into loginUrl.searchParams.set('next', currentPath). URLSearchParams will encode again, so % characters get double-encoded (e.g. %2F -> %252F), which can break the next redirect. Consider passing the raw pathname + search to searchParams.set (or keep encodeURI but build the query string manually, not via searchParams).


feat: configurable url prefix