Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
chore: allow configuration of shortcode base (#2748)
jerbob927d0219b11d40
diff --git a/packages/hoppscotch-app/.env.example b/packages/hoppscotch-app/.env.exampleindex c5bd6cbba..673d3505c 100644--- a/packages/hoppscotch-app/.env.example+++ b/packages/hoppscotch-app/.env.example@@ -14,8 +14,9 @@ VITE_MESSAGING_SENDER_ID=421993993223VITE_APP_ID=1:421993993223:web:ec0baa8ee8c02ffa1fc6a2VITE_MEASUREMENT_ID=G-BBJ3R80PJT-# Base URL+# Base URLsVITE_BASE_URL=https://hoppscotch.io+VITE_SHORTCODE_BASE_URL=https://hopp.sh# Backend URLsVITE_BACKEND_GQL_URL=https://api.hoppscotch.io/graphqldiff --git a/packages/hoppscotch-app/src/components/http/Request.vue b/packages/hoppscotch-app/src/components/http/Request.vueindex 72a82d8db..0f930873b 100644--- a/packages/hoppscotch-app/src/components/http/Request.vue+++ b/packages/hoppscotch-app/src/components/http/Request.vue@@ -452,17 +452,20 @@ const copyRequest = async () => {}const copyShareLink = (shareLink: string) => {+ const link = `${+ import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh"+ }/r${shareLink}`if (navigator.share) {const time = new Date().toLocaleTimeString()const date = new Date().toLocaleDateString()navigator.share({title: "Hoppscotch",text: `Hoppscotch • Open source API development ecosystem at ${time} on ${date}`,- url: `https://hopp.sh/r${shareLink}`,+ url: link,})} else {copyLinkIcon.value = IconCheck- copyToClipboard(`https://hopp.sh/r${shareLink}`)+ copyToClipboard(link)toast.success(`${t("state.copied_to_clipboard")}`)}}diff --git a/packages/hoppscotch-app/src/components/profile/Shortcode.vue b/packages/hoppscotch-app/src/components/profile/Shortcode.vueindex a5481fc81..74d6009eb 100644--- a/packages/hoppscotch-app/src/components/profile/Shortcode.vue+++ b/packages/hoppscotch-app/src/components/profile/Shortcode.vue@@ -18,7 +18,7 @@<ButtonSecondaryv-tippy="{ theme: 'tooltip' }":title="t('action.open_workspace')"- :to="`https://hopp.sh/r/${shortcode.id}`"+ :to="`${shortcodeBaseURL}/r/${shortcode.id}`"blank:icon="IconExternalLink"class="px-3 text-accent hover:text-accent"@@ -105,8 +105,11 @@ const requestLabelColor = computed(() =>const dateStamp = computed(() => shortDateTime(props.shortcode.createdOn))+const shortcodeBaseURL =+ import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh"+const copyShortcode = (codeID: string) => {- copyToClipboard(`https://hopp.sh/r/${codeID}`)+ copyToClipboard(`${shortcodeBaseURL}/r/${codeID}`)toast.success(`${t("state.copied_to_clipboard")}`)copyIconRefs.value = IconCheck}diff --git a/packages/hoppscotch-app/src/vite-envs.d.ts b/packages/hoppscotch-app/src/vite-envs.d.tsindex aa2de729e..ae58f12de 100644--- a/packages/hoppscotch-app/src/vite-envs.d.ts+++ b/packages/hoppscotch-app/src/vite-envs.d.ts@@ -16,6 +16,7 @@ interface ImportMetaEnv {readonly VITE_MEASUREMENT_ID: stringreadonly VITE_BASE_URL: string+ readonly VITE_SHORTCODE_BASE_URL: stringreadonly VITE_BACKEND_GQL_URL: stringreadonly VITE_BACKEND_WS_URL: string