Renames
This commit is contained in:
parent
251663f38c
commit
a0dd71f990
|
@ -96,7 +96,7 @@ export async function getAppIdFromCtx(ctx: Ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// look in the path
|
// look in the path
|
||||||
const pathId = parseAppIdFromUrl(ctx.path)
|
const pathId = parseAppIdFromUrlPath(ctx.path)
|
||||||
if (!appId && pathId) {
|
if (!appId && pathId) {
|
||||||
appId = confirmAppId(pathId)
|
appId = confirmAppId(pathId)
|
||||||
}
|
}
|
||||||
|
@ -116,19 +116,19 @@ export async function getAppIdFromCtx(ctx: Ctx) {
|
||||||
// referer header is present from a builder redirect
|
// referer header is present from a builder redirect
|
||||||
const referer = ctx.request.headers.referer
|
const referer = ctx.request.headers.referer
|
||||||
if (!appId && referer?.includes(BUILDER_APP_PREFIX)) {
|
if (!appId && referer?.includes(BUILDER_APP_PREFIX)) {
|
||||||
const refererId = parseAppIdFromUrl(ctx.request.headers.referer)
|
const refererId = parseAppIdFromUrlPath(ctx.request.headers.referer)
|
||||||
appId = confirmAppId(refererId)
|
appId = confirmAppId(refererId)
|
||||||
}
|
}
|
||||||
|
|
||||||
return appId
|
return appId
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseAppIdFromUrl(url?: string) {
|
function parseAppIdFromUrlPath(url?: string) {
|
||||||
if (!url) {
|
if (!url) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
.split("?")[0]
|
.split("?")[0] // Remove any possible query string
|
||||||
.split("/")
|
.split("/")
|
||||||
.find(subPath => subPath.startsWith(APP_PREFIX))
|
.find(subPath => subPath.startsWith(APP_PREFIX))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue