diff --git a/components/layout/Header.js b/components/layout/Header.js
index a81e016c..81c4e710 100644
--- a/components/layout/Header.js
+++ b/components/layout/Header.js
@@ -38,7 +38,7 @@ export default function Header() {
- {!process.env.isCloudMode && (
+ {!process.env.isAdminDisabled && (
diff --git a/components/settings/UserButton.js b/components/settings/UserButton.js
index 0d67bbd3..d1a8b4ca 100644
--- a/components/settings/UserButton.js
+++ b/components/settings/UserButton.js
@@ -28,7 +28,7 @@ export default function UserButton() {
{
label: ,
value: 'profile',
- hidden: process.env.isCloudMode,
+ hidden: process.env.isAdminDisabled,
},
{ label: , value: 'logout' },
];
diff --git a/next.config.js b/next.config.js
index e26d882e..3e649d2f 100644
--- a/next.config.js
+++ b/next.config.js
@@ -36,7 +36,7 @@ module.exports = {
env: {
currentVersion: pkg.version,
isProduction: process.env.NODE_ENV === 'production',
- isCloudMode: process.env.CLOUD_MODE,
+ isAdminDisabled: process.env.DISABLE_ADMIN,
},
basePath: process.env.BASE_PATH,
output: 'standalone',
diff --git a/pages/console/[[...id]].js b/pages/console/[[...id]].js
index a13537f8..0fd816b1 100644
--- a/pages/console/[[...id]].js
+++ b/pages/console/[[...id]].js
@@ -4,11 +4,11 @@ import TestConsole from 'components/pages/TestConsole';
import useRequireLogin from 'hooks/useRequireLogin';
import useUser from 'hooks/useUser';
-export default function ConsolePage({ enabled }) {
+export default function ConsolePage({ enabled, pageDisabled }) {
const { loading } = useRequireLogin();
const { user } = useUser();
- if (loading || !enabled || !user?.isAdmin) {
+ if (pageDisabled || loading || !enabled || !user?.isAdmin) {
return null;
}
@@ -21,6 +21,9 @@ export default function ConsolePage({ enabled }) {
export async function getServerSideProps() {
return {
- props: { enabled: !!process.env.ENABLE_TEST_CONSOLE },
+ props: {
+ pageDisabled: !!process.env.DISABLE_UI,
+ enabled: !!process.env.ENABLE_TEST_CONSOLE,
+ },
};
}
diff --git a/pages/dashboard/[[...id]].js b/pages/dashboard/[[...id]].js
index 7c762097..0959fd0e 100644
--- a/pages/dashboard/[[...id]].js
+++ b/pages/dashboard/[[...id]].js
@@ -5,7 +5,7 @@ import useRequireLogin from 'hooks/useRequireLogin';
import { useRouter } from 'next/router';
import useUser from 'hooks/useUser';
-export default function DashboardPage() {
+export default function DashboardPage({ pageDisabled }) {
const {
query: { id },
isReady,
@@ -14,7 +14,7 @@ export default function DashboardPage() {
const { loading } = useRequireLogin();
const user = useUser();
- if (!user || !isReady || loading) {
+ if (pageDisabled || !user || !isReady || loading) {
return null;
}
@@ -26,3 +26,11 @@ export default function DashboardPage() {
);
}
+
+export async function getServerSideProps() {
+ return {
+ props: {
+ pageDisabled: !!process.env.DISABLE_UI,
+ },
+ };
+}
diff --git a/pages/login.js b/pages/login.js
index 12f70ac9..29e9624f 100644
--- a/pages/login.js
+++ b/pages/login.js
@@ -2,8 +2,8 @@ import React from 'react';
import Layout from 'components/layout/Layout';
import LoginForm from 'components/forms/LoginForm';
-export default function LoginPage({ loginDisabled }) {
- if (loginDisabled) {
+export default function LoginPage({ pageDisabled }) {
+ if (pageDisabled) {
return null;
}
@@ -16,6 +16,9 @@ export default function LoginPage({ loginDisabled }) {
export async function getServerSideProps() {
return {
- props: { loginDisabled: !!process.env.DISABLE_LOGIN || !!process.env.isCloudMode },
+ props: {
+ pageDisabled:
+ !!process.env.DISABLE_LOGIN || !!process.env.DISABLE_UI || !!process.env.isAdminDisabled,
+ },
};
}
diff --git a/pages/realtime.js b/pages/realtime.js
index 9f1ebffa..30dc1467 100644
--- a/pages/realtime.js
+++ b/pages/realtime.js
@@ -3,10 +3,10 @@ import Layout from 'components/layout/Layout';
import RealtimeDashboard from 'components/pages/RealtimeDashboard';
import useRequireLogin from 'hooks/useRequireLogin';
-export default function RealtimePage() {
+export default function RealtimePage({ pageDisabled }) {
const { loading } = useRequireLogin();
- if (loading) {
+ if (pageDisabled || loading) {
return null;
}
@@ -16,3 +16,11 @@ export default function RealtimePage() {
);
}
+
+export async function getServerSideProps() {
+ return {
+ props: {
+ pageDisabled: !!process.env.DISABLE_UI,
+ },
+ };
+}
diff --git a/pages/settings/accounts.js b/pages/settings/accounts.js
index 3426f4b8..c46f179a 100644
--- a/pages/settings/accounts.js
+++ b/pages/settings/accounts.js
@@ -1,3 +1,11 @@
import Index from './index';
export default Index;
+
+export async function getServerSideProps() {
+ return {
+ props: {
+ pageDisabled: !!process.env.DISABLE_UI,
+ },
+ };
+}
diff --git a/pages/settings/index.js b/pages/settings/index.js
index 18f33109..9bb1b0fa 100644
--- a/pages/settings/index.js
+++ b/pages/settings/index.js
@@ -3,10 +3,10 @@ import Layout from 'components/layout/Layout';
import Settings from 'components/pages/Settings';
import useRequireLogin from 'hooks/useRequireLogin';
-export default function SettingsPage() {
+export default function SettingsPage({ pageDisabled }) {
const { loading } = useRequireLogin();
- if (process.env.isCloudMode || loading) {
+ if (pageDisabled || loading) {
return null;
}
@@ -16,3 +16,11 @@ export default function SettingsPage() {
);
}
+
+export async function getServerSideProps() {
+ return {
+ props: {
+ pageDisabled: !!process.env.DISABLE_UI || !!process.env.isAdminDisabled,
+ },
+ };
+}
diff --git a/pages/settings/profile.js b/pages/settings/profile.js
index 3426f4b8..c46f179a 100644
--- a/pages/settings/profile.js
+++ b/pages/settings/profile.js
@@ -1,3 +1,11 @@
import Index from './index';
export default Index;
+
+export async function getServerSideProps() {
+ return {
+ props: {
+ pageDisabled: !!process.env.DISABLE_UI,
+ },
+ };
+}
diff --git a/pages/share/[...id].js b/pages/share/[...id].js
index d449afa5..6c81a67a 100644
--- a/pages/share/[...id].js
+++ b/pages/share/[...id].js
@@ -4,13 +4,13 @@ import Layout from 'components/layout/Layout';
import WebsiteDetails from 'components/pages/WebsiteDetails';
import useShareToken from 'hooks/useShareToken';
-export default function SharePage() {
+export default function SharePage({ pageDisabled }) {
const router = useRouter();
const { id } = router.query;
const shareId = id?.[0];
const shareToken = useShareToken(shareId);
- if (!shareToken) {
+ if (pageDisabled || !shareToken) {
return null;
}
@@ -20,3 +20,11 @@ export default function SharePage() {
);
}
+
+export async function getServerSideProps() {
+ return {
+ props: {
+ pageDisabled: !!process.env.DISABLE_UI,
+ },
+ };
+}
diff --git a/pages/websites/[...id].js b/pages/websites/[...id].js
index 90f4f492..7d068d3d 100644
--- a/pages/websites/[...id].js
+++ b/pages/websites/[...id].js
@@ -4,12 +4,12 @@ import Layout from 'components/layout/Layout';
import WebsiteDetails from 'components/pages/WebsiteDetails';
import useRequireLogin from 'hooks/useRequireLogin';
-export default function DetailsPage() {
+export default function DetailsPage({ pageDisabled }) {
const { loading } = useRequireLogin();
const router = useRouter();
const { id } = router.query;
- if (!id || loading) {
+ if (pageDisabled || !id || loading) {
return null;
}
@@ -21,3 +21,11 @@ export default function DetailsPage() {
);
}
+
+export async function getServerSideProps() {
+ return {
+ props: {
+ pageDisabled: !!process.env.DISABLE_UI,
+ },
+ };
+}