diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue b/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue index d171ce9a11..c8690be865 100644 --- a/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue +++ b/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue @@ -18,22 +18,12 @@ const sharedBase = ref(null) const { base } = storeToRefs(useBase()) -const { getBaseUrl, appInfo } = useGlobal() - -const workspaceStore = useWorkspace() +const { appInfo } = useGlobal() const url = computed(() => { if (!sharedBase.value || !sharedBase.value.uuid) return '' - // get base url for workspace - const baseUrl = getBaseUrl(workspaceStore.activeWorkspaceId) - - let dashboardUrl1 = dashboardUrl.value - - if (baseUrl) { - dashboardUrl1 = `${baseUrl}${appInfo.value?.dashboardPath}` - } - return encodeURI(`${dashboardUrl1}#/base/${sharedBase.value.uuid}`) + return encodeURI(`${dashboardUrl.value}#/base/${sharedBase.value.uuid}`) }) const loadBase = async () => { diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue index f644852665..8fac6d85dd 100644 --- a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue +++ b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue @@ -4,7 +4,7 @@ import { ViewTypes } from 'nocodb-sdk' const { view: _view, $api } = useSmartsheetStoreOrThrow() const { $e } = useNuxtApp() -const { getBaseUrl, appInfo } = useGlobal() +const { appInfo } = useGlobal() const { dashboardUrl } = useDashboard() @@ -203,15 +203,7 @@ function sharedViewUrl() { viewType = 'view' } - // get base url for workspace - const baseUrl = getBaseUrl(workspaceStore.activeWorkspaceId) - - let dashboardUrl1 = dashboardUrl.value - if (baseUrl) { - dashboardUrl1 = `${baseUrl}${appInfo.value?.dashboardPath}` - } - - return `${encodeURI(`${dashboardUrl1}#/nc/${viewType}/${activeView.value.uuid}${surveyMode.value ? '/survey' : ''}`)}${ + return `${encodeURI(`${dashboardUrl.value}#/nc/${viewType}/${activeView.value.uuid}${surveyMode.value ? '/survey' : ''}`)}${ viewStore.preFillFormSearchParams && formPreFill.value.preFillEnabled ? `?${viewStore.preFillFormSearchParams}` : '' }` } diff --git a/packages/nocodb/src/run/cloud.ts b/packages/nocodb/src/run/cloud.ts index bfcc4174a4..14518b23a8 100644 --- a/packages/nocodb/src/run/cloud.ts +++ b/packages/nocodb/src/run/cloud.ts @@ -15,6 +15,16 @@ server.use( process.env.NC_DASHBOARD_URL ?? '/dashboard', express.static(path.join(__dirname, 'nc-gui')), ); + +// if NC_DASHBOARD_URL is not set to /dashboard, then redirect '/dashboard' +// to the path set in NC_DASHBOARD_URL +if (!/^\/?dashboard\/?$/.test(process.env.NC_DASHBOARD_URL)) { + server.use('/dashboard', (_, res) => { + // redirect to NC_DASHBOARD_URL path + res.redirect(process.env.NC_DASHBOARD_URL); + }); +} + server.set('view engine', 'ejs'); (async () => {