diff --git a/client/src/components/Sharing/Embeds/WorkflowEmbed.vue b/client/src/components/Sharing/Embeds/WorkflowEmbed.vue index 538ca956c8ea..649794bc7d9b 100644 --- a/client/src/components/Sharing/Embeds/WorkflowEmbed.vue +++ b/client/src/components/Sharing/Embeds/WorkflowEmbed.vue @@ -6,8 +6,8 @@ import { useDebounce } from "@vueuse/core"; import { BButton, BFormCheckbox, BFormInput, BInputGroup, BInputGroupAppend } from "bootstrap-vue"; import { computed, reactive, ref } from "vue"; -import { getAppRoot } from "@/onload/loadConfig"; import { copy } from "@/utils/clipboard"; +import { getFullAppUrl } from "@/utils/utils"; import ZoomControl from "@/components/Workflow/Editor/ZoomControl.vue"; import WorkflowPublished from "@/components/Workflow/Published/WorkflowPublished.vue"; @@ -39,13 +39,8 @@ function onChangePosition(event: Event, xy: "x" | "y") { } } -const root = computed(() => { - const port = window.location.port ? `:${window.location.port}` : ""; - return `${window.location.protocol}//${window.location.hostname}${port}${getAppRoot()}`; -}); - const embedUrl = computed(() => { - let url = `${root.value}published/workflow?id=${props.id}&embed=true`; + let url = getFullAppUrl(`published/workflow?id=${props.id}&embed=true`); url += `&buttons=${settings.buttons}`; url += `&about=${settings.about}`; url += `&heading=${settings.heading}`; diff --git a/client/src/components/Sharing/SharingPage.vue b/client/src/components/Sharing/SharingPage.vue index e05fcb2d3480..1bbfb73a981c 100644 --- a/client/src/components/Sharing/SharingPage.vue +++ b/client/src/components/Sharing/SharingPage.vue @@ -9,6 +9,7 @@ import { getGalaxyInstance } from "@/app"; import { useToast } from "@/composables/toast"; import { getAppRoot } from "@/onload/loadConfig"; import { errorMessageAsString } from "@/utils/simple-error"; +import { getFullAppUrl } from "@/utils/utils"; import type { Item, ShareOption } from "./item"; @@ -52,11 +53,6 @@ const item = ref({ extra: defaultExtra(), }); -const itemRoot = computed(() => { - const port = window.location.port ? `:${window.location.port}` : ""; - return `${window.location.protocol}//${window.location.hostname}${port}${getAppRoot()}`; -}); - const itemUrl = reactive({ prefix: "", slug: "", @@ -68,7 +64,7 @@ watch( if (value) { const index = value.lastIndexOf("/"); - itemUrl.prefix = itemRoot.value + value.substring(0, index + 1); + itemUrl.prefix = getFullAppUrl(value.substring(0, index + 1)); itemUrl.slug = value.substring(index + 1); } }, diff --git a/client/src/components/Workflow/Published/WorkflowInformation.vue b/client/src/components/Workflow/Published/WorkflowInformation.vue index 2b5e986ff9c2..b9d9afb1acb5 100644 --- a/client/src/components/Workflow/Published/WorkflowInformation.vue +++ b/client/src/components/Workflow/Published/WorkflowInformation.vue @@ -5,8 +5,8 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { computed } from "vue"; import { RouterLink } from "vue-router"; -import { getAppRoot } from "@/onload/loadConfig"; import { useUserStore } from "@/stores/userStore"; +import { getFullAppUrl } from "@/utils/utils"; import Heading from "@/components/Common/Heading.vue"; import CopyToClipboard from "@/components/CopyToClipboard.vue"; @@ -42,17 +42,12 @@ const gravatarSource = computed( const publishedByUser = computed(() => `/workflows/list_published?owner=${props.workflowInfo?.owner}`); -const root = computed(() => { - const port = window.location.port ? `:${window.location.port}` : ""; - return `${window.location.protocol}//${window.location.hostname}${port}${getAppRoot()}`; -}); - const relativeLink = computed(() => { return `/published/workflow?id=${props.workflowInfo.id}`; }); const fullLink = computed(() => { - return `${root.value}${relativeLink.value.substring(1)}`; + return getFullAppUrl(relativeLink.value.substring(1)); }); const userOwned = computed(() => { diff --git a/client/src/components/Workflow/WorkflowActionsExtend.vue b/client/src/components/Workflow/WorkflowActionsExtend.vue index 5f15d7142844..98d0484e45ca 100644 --- a/client/src/components/Workflow/WorkflowActionsExtend.vue +++ b/client/src/components/Workflow/WorkflowActionsExtend.vue @@ -1,15 +1,6 @@