diff --git a/common/src/envs/constants.ts b/common/src/envs/constants.ts index 25fd8853..43a59ffa 100644 --- a/common/src/envs/constants.ts +++ b/common/src/envs/constants.ts @@ -107,3 +107,5 @@ export const RESERVED_PATHS = [ 'web', 'welcome', ] + +export const LOCAL_WEB_URL = 'http://localhost:3000'; diff --git a/common/src/love/og-image.ts b/common/src/love/og-image.ts index 07714177..734d7ee9 100644 --- a/common/src/love/og-image.ts +++ b/common/src/love/og-image.ts @@ -24,5 +24,5 @@ export function getLoveOgImageUrl(user: User, lover?: LoverRow | null) { gender: lover?.gender ?? '???', } as LoveOgProps - return buildOgUrl(loveProps, 'lover', 'compassmeet.com') + return buildOgUrl(loveProps, 'lover') } diff --git a/common/src/util/og.ts b/common/src/util/og.ts index 0de59672..776ee15e 100644 --- a/common/src/util/og.ts +++ b/common/src/util/og.ts @@ -1,4 +1,5 @@ -import { DOMAIN } from 'common/envs/constants' +import {DOMAIN, LOCAL_WEB_URL} from 'common/envs/constants' +import {LOCAL_DEV} from "shared/lib/utils"; // opengraph functions that run in static props or client-side, but not in the edge (in image creation) @@ -10,10 +11,5 @@ export function buildOgUrl
>( const generateUrlParams = (params: P) => new URLSearchParams(params).toString() - // Change to localhost:3000 for local testing - const url = - // `http://localhost:3000/api/og/${endpoint}?` + generateUrlParams(props) - `https://${domain ?? DOMAIN}/api/og/${endpoint}?` + generateUrlParams(props) - - return url + return `https://${domain ?? LOCAL_DEV ? LOCAL_WEB_URL : DOMAIN}/api/og/${endpoint}?` + generateUrlParams(props) }