From a55f214102fc1398ac4c861783692270f8fe22b9 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Tue, 12 Dec 2023 15:06:28 +0530 Subject: [PATCH] fix: use base url instead of hardcoded url (#3635) --- .../src/components/embeds/index.vue | 6 +++-- .../src/components/history/index.vue | 2 +- .../src/components/http/Request.vue | 24 +++++++++---------- .../src/components/share/CustomizeModal.vue | 15 ++++++------ .../src/components/share/index.vue | 2 +- .../src/components/share/templates/Link.vue | 7 +++++- .../src/components/button/Primary.vue | 2 +- 7 files changed, 33 insertions(+), 25 deletions(-) diff --git a/packages/hoppscotch-common/src/components/embeds/index.vue b/packages/hoppscotch-common/src/components/embeds/index.vue index 345f76afd..dee53a39f 100644 --- a/packages/hoppscotch-common/src/components/embeds/index.vue +++ b/packages/hoppscotch-common/src/components/embeds/index.vue @@ -105,9 +105,11 @@ const requestCancelFunc: Ref<(() => void) | null> = ref(null) const loading = ref(false) -const baseURL = import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh" +const shortcodeBaseURL = + import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh" + const sharedRequestURL = computed(() => { - return `${baseURL}/r/${props.sharedRequestID}` + return `${shortcodeBaseURL}/r/${props.sharedRequestID}` }) const { subscribeToStream } = useStreamSubscriber() diff --git a/packages/hoppscotch-common/src/components/history/index.vue b/packages/hoppscotch-common/src/components/history/index.vue index f241407aa..1d8c02905 100644 --- a/packages/hoppscotch-common/src/components/history/index.vue +++ b/packages/hoppscotch-common/src/components/history/index.vue @@ -3,7 +3,7 @@
- +
+ +
-
-
diff --git a/packages/hoppscotch-common/src/components/share/CustomizeModal.vue b/packages/hoppscotch-common/src/components/share/CustomizeModal.vue index c5abdd007..d810b3814 100644 --- a/packages/hoppscotch-common/src/components/share/CustomizeModal.vue +++ b/packages/hoppscotch-common/src/components/share/CustomizeModal.vue @@ -370,10 +370,11 @@ const linkVariants: LinkVariant[] = [ }, ] -const baseURL = import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh" +const shortcodeBaseURL = + import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh" const copyEmbed = () => { - return `` } const copyButton = ( @@ -390,18 +391,18 @@ const copyButton = ( } if (type === "markdown") { - return `[![Run in Hoppscotch](${baseURL}/${badge})](${baseURL}/r/${props.request?.id})` + return `[![Run in Hoppscotch](${shortcodeBaseURL}/${badge})](${shortcodeBaseURL}/r/${props.request?.id})` } - return `Run in Hoppscotch` + return `Run in Hoppscotch` } const copyLink = (variationID: string) => { if (variationID === "link1") { - return `${baseURL}/r/${props.request?.id}` + return `${shortcodeBaseURL}/r/${props.request?.id}` } else if (variationID === "link2") { - return `Run in Hoppscotch` + return `Run in Hoppscotch` } - return `[Run in Hoppscotch](${baseURL}/r/${props.request?.id})` + return `[Run in Hoppscotch](${shortcodeBaseURL}/r/${props.request?.id})` } const copyContent = ({ diff --git a/packages/hoppscotch-common/src/components/share/index.vue b/packages/hoppscotch-common/src/components/share/index.vue index 38fed740d..8d029bc94 100644 --- a/packages/hoppscotch-common/src/components/share/index.vue +++ b/packages/hoppscotch-common/src/components/share/index.vue @@ -13,7 +13,7 @@ > () +const shortcodeBaseURL = + import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh" + const text = computed(() => { - return props.label ? t(props.label) : `hopp.sh/r/${props.link ?? "xxxx"}` + return props.label + ? t(props.label) + : `${shortcodeBaseURL}/r/${props.link ?? "xxxx"}` }) diff --git a/packages/hoppscotch-ui/src/components/button/Primary.vue b/packages/hoppscotch-ui/src/components/button/Primary.vue index 8ccad76f2..aaada449e 100644 --- a/packages/hoppscotch-ui/src/components/button/Primary.vue +++ b/packages/hoppscotch-ui/src/components/button/Primary.vue @@ -2,7 +2,7 @@