diff --git a/src/frontend/src/features/diagnostics/routes/ConnectionTest.tsx b/src/frontend/src/features/diagnostics/routes/ConnectionTest.tsx index 3d771417..d4eb3134 100644 --- a/src/frontend/src/features/diagnostics/routes/ConnectionTest.tsx +++ b/src/frontend/src/features/diagnostics/routes/ConnectionTest.tsx @@ -17,6 +17,8 @@ import { ConnectionTestStepRow } from '../components/ConnectionTestStepRow' import { ConnectionTestSummary } from '../components/ConnectionTestSummary' import { CONNECTION_TEST_GROUPS, summarizeSteps } from '../types' import { downloadConnectionTestReport } from '../utils/downloadConnectionTestReport' +import { useConfig } from '@/api/useConfig' +import { navigateTo } from '@/navigation/navigateTo' const HIDE_LIVEKIT_VIDEO_CLASS = 'connection-test-hide-livekit-video' @@ -59,6 +61,7 @@ const helpIconClass = css({ }) const ConnectionTest = () => { + const { data, isLoading } = useConfig() const { t } = useTranslation('connectionTest') const { steps, isRunning, runTest, reset } = useConnectionTestRunner() @@ -82,6 +85,14 @@ const ConnectionTest = () => { } }, [isPublishVideoRunning]) + useEffect(() => { + // Wait for config to load, otherwise we'd redirect off a page + // that's actually enabled. + if (!isLoading && !data?.diagnostics?.connection_test_enabled) { + navigateTo('home', undefined, { replace: true }) + } + }, [isLoading, data]) + return ( diff --git a/src/frontend/src/layout/Footer.tsx b/src/frontend/src/layout/Footer.tsx index 671f77a5..cfbfc426 100644 --- a/src/frontend/src/layout/Footer.tsx +++ b/src/frontend/src/layout/Footer.tsx @@ -266,16 +266,18 @@ export const Footer = () => { {t('links.accessibility')} - - - {t('links.connectionTest')} - - + {data?.diagnostics?.connection_test_enabled && ( + + + {t('links.connectionTest')} + + + )}