Skip to content

Commit

Permalink
revert(viewer): ⏪️ Make sure old viewer URL still works
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 23, 2022
1 parent 03aadab commit b16c47a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions apps/viewer/pages/[[...publicId]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ export const getServerSideProps: GetServerSideProps = async (
let typebot: Omit<PublicTypebot, 'createdAt' | 'updatedAt'> | null
const isIE = /MSIE|Trident/.test(context.req.headers['user-agent'] ?? '')
const pathname = context.resolvedUrl.split('?')[0]
console.log('pathname:', pathname)
try {
if (!context.req.headers.host) return { props: {} }
console.log('context.req.headers.host:', context.req.headers.host)
typebot = context.req.headers.host.includes(
(process.env.NEXT_PUBLIC_VIEWER_URL ?? '').split('//')[1]
const viewerUrls = (process.env.NEXT_PUBLIC_VIEWER_URL ?? '').split(',')
typebot = viewerUrls.some((url) =>
context.req.headers.host?.includes(url.split('//')[1])
)
? await getTypebotFromPublicId(context.query.publicId?.toString())
: await getTypebotFromCustomDomain(
Expand Down

3 comments on commit b16c47a

@vercel
Copy link

@vercel vercel bot commented on b16c47a Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on b16c47a Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

app.typebot.io
builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app

Please sign in to comment.