Fix og url for local

This commit is contained in:
MartinBraquet
2025-09-12 17:00:49 +02:00
parent 048e6affbc
commit fef6a52008
3 changed files with 6 additions and 8 deletions

View File

@@ -107,3 +107,5 @@ export const RESERVED_PATHS = [
'web',
'welcome',
]
export const LOCAL_WEB_URL = 'http://localhost:3000';

View File

@@ -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')
}

View File

@@ -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<P extends Record<string, string>>(
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)
}