Refactor: BUILDER_REFERER_PREFIX -> BUILDER_APP_PREFIX

This commit is contained in:
jvcalderon 2023-05-12 15:59:42 +02:00
parent a48fc00a54
commit 946cd45b3f
1 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ const PROD_APP_PREFIX = "/app/"
const BUILDER_PREVIEW_PATH = "/app/preview"
const BUILDER_PREFIX = "/builder"
const BUILDER_REFERER_PREFIX = `${BUILDER_PREFIX}/app/`
const BUILDER_APP_PREFIX = `${BUILDER_PREFIX}/app/`
const PUBLIC_API_PREFIX = "/api/public/v"
function confirmAppId(possibleAppId: string | undefined) {
@ -66,7 +66,7 @@ export function isServingApp(ctx: Ctx) {
}
export function isServingBuilder(ctx: Ctx): boolean {
return ctx.path.startsWith(BUILDER_REFERER_PREFIX)
return ctx.path.startsWith(BUILDER_APP_PREFIX)
}
export function isServingBuilderPreview(ctx: Ctx): boolean {
@ -118,7 +118,7 @@ export async function getAppIdFromCtx(ctx: Ctx) {
// make sure this is performed after prod app url resolution, in case the
// referer header is present from a builder redirect
const referer = ctx.request.headers.referer
if (!appId && referer?.includes(BUILDER_REFERER_PREFIX)) {
if (!appId && referer?.includes(BUILDER_APP_PREFIX)) {
const refererId = parseAppIdFromUrl(ctx.request.headers.referer)
appId = confirmAppId(refererId)
}