mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 02:06:19 +01:00
Merge pull request #1612 from umami-software/feat/um-76-turn-off-ui
Feat/um 76 turn off UI
This commit is contained in:
commit
ba63991a92
@ -38,7 +38,7 @@ export default function Header() {
|
||||
<Link href="/realtime">
|
||||
<FormattedMessage id="label.realtime" defaultMessage="Realtime" />
|
||||
</Link>
|
||||
{!process.env.isCloudMode && (
|
||||
{!process.env.isAdminDisabled && (
|
||||
<Link href="/settings">
|
||||
<FormattedMessage id="label.settings" defaultMessage="Settings" />
|
||||
</Link>
|
||||
|
@ -28,7 +28,7 @@ export default function UserButton() {
|
||||
{
|
||||
label: <FormattedMessage id="label.profile" defaultMessage="Profile" />,
|
||||
value: 'profile',
|
||||
hidden: process.env.isCloudMode,
|
||||
hidden: process.env.isAdminDisabled,
|
||||
},
|
||||
{ label: <FormattedMessage id="label.logout" defaultMessage="Logout" />, value: 'logout' },
|
||||
];
|
||||
|
@ -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',
|
||||
|
@ -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,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -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() {
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
pageDisabled: !!process.env.DISABLE_UI,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -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,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -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() {
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
pageDisabled: !!process.env.DISABLE_UI,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -1,3 +1,11 @@
|
||||
import Index from './index';
|
||||
|
||||
export default Index;
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
pageDisabled: !!process.env.DISABLE_UI,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -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() {
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
pageDisabled: !!process.env.DISABLE_UI || !!process.env.isAdminDisabled,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -1,3 +1,11 @@
|
||||
import Index from './index';
|
||||
|
||||
export default Index;
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
pageDisabled: !!process.env.DISABLE_UI,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -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() {
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
pageDisabled: !!process.env.DISABLE_UI,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -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() {
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
pageDisabled: !!process.env.DISABLE_UI,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user