diff --git a/app/soapbox/features/public-layout/index.tsx b/app/soapbox/features/public-layout/index.tsx index 0fdc8b946..3671b5ae8 100644 --- a/app/soapbox/features/public-layout/index.tsx +++ b/app/soapbox/features/public-layout/index.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Switch, Route, Redirect } from 'react-router-dom'; import LandingGradient from 'soapbox/components/landing-gradient'; -import { useAppSelector } from 'soapbox/hooks'; +import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks'; import { isStandalone } from 'soapbox/utils/state'; import AboutPage from '../about'; @@ -13,6 +13,9 @@ import Header from './components/header'; const PublicLayout = () => { const standalone = useAppSelector((state) => isStandalone(state)); + const soapboxConfig = useSoapboxConfig(); + + const shouldRedirectFromRoot = soapboxConfig.redirectRootNoLogin && !soapboxConfig.redirectRootNoLogin.match(/^\/?$/); if (standalone) { return ; @@ -28,7 +31,11 @@ const PublicLayout = () => {
- + {shouldRedirectFromRoot ? ( + + ) : ( + + )}
diff --git a/app/soapbox/normalizers/soapbox/soapbox-config.ts b/app/soapbox/normalizers/soapbox/soapbox-config.ts index b221afabe..06848cc7a 100644 --- a/app/soapbox/normalizers/soapbox/soapbox-config.ts +++ b/app/soapbox/normalizers/soapbox/soapbox-config.ts @@ -115,6 +115,7 @@ export const SoapboxConfigRecord = ImmutableRecord({ feedInjection: true, tileServer: '', tileServerAttribution: '', + redirectRootNoLogin: '/', }, 'SoapboxConfig'); type SoapboxConfigMap = ImmutableMap;