From 5487d5b61a9df3b2b2727f7e5aa5c46dc41a9b89 Mon Sep 17 00:00:00 2001 From: Alaister Young Date: Mon, 13 Nov 2023 15:58:16 +1100 Subject: [PATCH] fix: update self-hosted auth redirects (#18903) chore: update self-hosted auth redirects --- studio/next.config.js | 119 +++++++++++++++++++++++++++--------------- 1 file changed, 77 insertions(+), 42 deletions(-) diff --git a/studio/next.config.js b/studio/next.config.js index b407efe2ff113..fab20a783150f 100644 --- a/studio/next.config.js +++ b/studio/next.config.js @@ -29,48 +29,83 @@ const nextConfig = { output: 'standalone', async redirects() { return [ - { - source: '/', - has: [ - { - type: 'query', - key: 'next', - value: 'new-project', - }, - ], - destination: '/new/new-project', - permanent: false, - }, - { - source: '/', - destination: '/projects', - permanent: false, - }, - { - source: '/register', - destination: '/sign-up', - permanent: false, - }, - { - source: '/signup', - destination: '/sign-up', - permanent: false, - }, - { - source: '/signin', - destination: '/sign-in', - permanent: false, - }, - { - source: '/login', - destination: '/sign-in', - permanent: false, - }, - { - source: '/log-in', - destination: '/sign-in', - permanent: false, - }, + ...(process.env.NEXT_PUBLIC_IS_PLATFORM === 'true' + ? [ + { + source: '/', + has: [ + { + type: 'query', + key: 'next', + value: 'new-project', + }, + ], + destination: '/new/new-project', + permanent: false, + }, + { + source: '/', + destination: '/projects', + permanent: false, + }, + { + source: '/register', + destination: '/sign-up', + permanent: false, + }, + { + source: '/signup', + destination: '/sign-up', + permanent: false, + }, + { + source: '/signin', + destination: '/sign-in', + permanent: false, + }, + { + source: '/login', + destination: '/sign-in', + permanent: false, + }, + { + source: '/log-in', + destination: '/sign-in', + permanent: false, + }, + ] + : [ + { + source: '/', + destination: '/project/default', + permanent: false, + }, + { + source: '/register', + destination: '/project/default', + permanent: false, + }, + { + source: '/signup', + destination: '/project/default', + permanent: false, + }, + { + source: '/signin', + destination: '/project/default', + permanent: false, + }, + { + source: '/login', + destination: '/project/default', + permanent: false, + }, + { + source: '/log-in', + destination: '/project/default', + permanent: false, + }, + ]), { source: '/project/:ref/auth', destination: '/project/:ref/auth/users',