mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 09:45:04 +01:00
Added checks for CLOUD_MODE.
This commit is contained in:
parent
5657a64c77
commit
3ac560dc0f
@ -2,13 +2,15 @@ import { Container } from 'react-basics';
|
|||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import NavBar from 'components/layout/NavBar';
|
import NavBar from 'components/layout/NavBar';
|
||||||
import useRequireLogin from 'hooks/useRequireLogin';
|
import useRequireLogin from 'hooks/useRequireLogin';
|
||||||
|
import useConfig from 'hooks/useConfig';
|
||||||
import { UI_LAYOUT_BODY } from 'lib/constants';
|
import { UI_LAYOUT_BODY } from 'lib/constants';
|
||||||
import styles from './AppLayout.module.css';
|
import styles from './AppLayout.module.css';
|
||||||
|
|
||||||
export default function AppLayout({ title, children }) {
|
export default function AppLayout({ title, children }) {
|
||||||
const { user } = useRequireLogin();
|
const { user } = useRequireLogin();
|
||||||
|
const config = useConfig();
|
||||||
|
|
||||||
if (!user) {
|
if (!user || !config) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,9 +10,11 @@ import { labels } from 'components/messages';
|
|||||||
import useUser from 'hooks/useUser';
|
import useUser from 'hooks/useUser';
|
||||||
import NavGroup from './NavGroup';
|
import NavGroup from './NavGroup';
|
||||||
import styles from './NavBar.module.css';
|
import styles from './NavBar.module.css';
|
||||||
|
import useConfig from 'hooks/useConfig';
|
||||||
|
|
||||||
export default function NavBar() {
|
export default function NavBar() {
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
|
const { cloudMode } = useConfig();
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const [minimized, setMinimized] = useState(false);
|
const [minimized, setMinimized] = useState(false);
|
||||||
const tooltipPosition = minimized ? 'right' : 'top';
|
const tooltipPosition = minimized ? 'right' : 'top';
|
||||||
@ -24,13 +26,21 @@ export default function NavBar() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const settings = [
|
const settings = [
|
||||||
{ label: formatMessage(labels.websites), url: '/settings/websites', icon: <Icons.Globe /> },
|
!cloudMode && {
|
||||||
|
label: formatMessage(labels.websites),
|
||||||
|
url: '/settings/websites',
|
||||||
|
icon: <Icons.Globe />,
|
||||||
|
},
|
||||||
user?.isAdmin && {
|
user?.isAdmin && {
|
||||||
label: formatMessage(labels.users),
|
label: formatMessage(labels.users),
|
||||||
url: '/settings/users',
|
url: '/settings/users',
|
||||||
icon: <Icons.User />,
|
icon: <Icons.User />,
|
||||||
},
|
},
|
||||||
{ label: formatMessage(labels.teams), url: '/settings/teams', icon: <Icons.Users /> },
|
!cloudMode && {
|
||||||
|
label: formatMessage(labels.teams),
|
||||||
|
url: '/settings/teams',
|
||||||
|
icon: <Icons.Users />,
|
||||||
|
},
|
||||||
{ label: formatMessage(labels.profile), url: '/settings/profile', icon: <Icons.Profile /> },
|
{ label: formatMessage(labels.profile), url: '/settings/profile', icon: <Icons.Profile /> },
|
||||||
].filter(n => n);
|
].filter(n => n);
|
||||||
|
|
||||||
@ -53,7 +63,7 @@ export default function NavBar() {
|
|||||||
<div className={styles.buttons}>
|
<div className={styles.buttons}>
|
||||||
<ThemeButton tooltipPosition={tooltipPosition} />
|
<ThemeButton tooltipPosition={tooltipPosition} />
|
||||||
<LanguageButton tooltipPosition={tooltipPosition} />
|
<LanguageButton tooltipPosition={tooltipPosition} />
|
||||||
<LogoutButton tooltipPosition={tooltipPosition} />
|
{!cloudMode && <LogoutButton tooltipPosition={tooltipPosition} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,14 +4,16 @@ import PageHeader from 'components/layout/PageHeader';
|
|||||||
import ProfileDetails from './ProfileDetails';
|
import ProfileDetails from './ProfileDetails';
|
||||||
import PasswordChangeButton from './PasswordChangeButton';
|
import PasswordChangeButton from './PasswordChangeButton';
|
||||||
import { labels } from 'components/messages';
|
import { labels } from 'components/messages';
|
||||||
|
import useConfig from 'hooks/useConfig';
|
||||||
|
|
||||||
export default function ProfileSettings() {
|
export default function ProfileSettings() {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
const { cloudMode } = useConfig();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<PageHeader title={formatMessage(labels.profile)}>
|
<PageHeader title={formatMessage(labels.profile)}>
|
||||||
<PasswordChangeButton />
|
{!cloudMode && <PasswordChangeButton />}
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
<ProfileDetails />
|
<ProfileDetails />
|
||||||
</Page>
|
</Page>
|
||||||
|
@ -65,7 +65,7 @@ export default function TeamsList() {
|
|||||||
return (
|
return (
|
||||||
<Page loading={isLoading} error={error}>
|
<Page loading={isLoading} error={error}>
|
||||||
{toast}
|
{toast}
|
||||||
<PageHeader title={formatMessage(labels.team)}>
|
<PageHeader title={formatMessage(labels.teams)}>
|
||||||
{hasData && (
|
{hasData && (
|
||||||
<Flexbox gap={10}>
|
<Flexbox gap={10}>
|
||||||
{joinButton}
|
{joinButton}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { Button, Form, FormRow, Modal, ModalTrigger } from 'react-basics';
|
import { Button, Modal, ModalTrigger, ActionForm } from 'react-basics';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
import WebsiteDeleteForm from 'components/pages/settings/websites/WebsiteDeleteForm';
|
import WebsiteDeleteForm from 'components/pages/settings/websites/WebsiteDeleteForm';
|
||||||
import WebsiteResetForm from 'components/pages/settings/websites/WebsiteResetForm';
|
import WebsiteResetForm from 'components/pages/settings/websites/WebsiteResetForm';
|
||||||
import { labels, messages } from 'components/messages';
|
import { labels, messages } from 'components/messages';
|
||||||
|
|
||||||
export default function WebsiteReset({ websiteId, onSave }) {
|
export default function WebsiteData({ websiteId, onSave }) {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
const handleReset = async () => {
|
const handleReset = async () => {
|
||||||
@ -16,29 +16,33 @@ export default function WebsiteReset({ websiteId, onSave }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form>
|
<>
|
||||||
<FormRow label={formatMessage(labels.resetWebsite)}>
|
<ActionForm
|
||||||
<p>{formatMessage(messages.resetWebsiteWarning)}</p>
|
label={formatMessage(labels.resetWebsite)}
|
||||||
|
description={formatMessage(messages.resetWebsiteWarning)}
|
||||||
|
>
|
||||||
<ModalTrigger>
|
<ModalTrigger>
|
||||||
<Button>{formatMessage(labels.reset)}</Button>
|
<Button variant="secondary">{formatMessage(labels.reset)}</Button>
|
||||||
<Modal title={formatMessage(labels.resetWebsite)}>
|
<Modal title={formatMessage(labels.resetWebsite)}>
|
||||||
{close => (
|
{close => (
|
||||||
<WebsiteResetForm websiteId={websiteId} onSave={handleReset} onClose={close} />
|
<WebsiteResetForm websiteId={websiteId} onSave={handleReset} onClose={close} />
|
||||||
)}
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
</ModalTrigger>
|
</ModalTrigger>
|
||||||
</FormRow>
|
</ActionForm>
|
||||||
<FormRow label={formatMessage(labels.deleteWebsite)}>
|
<ActionForm
|
||||||
<p>{formatMessage(messages.deleteWebsiteWarning)}</p>
|
label={formatMessage(labels.deleteWebsite)}
|
||||||
|
description={formatMessage(messages.deleteWebsiteWarning)}
|
||||||
|
>
|
||||||
<ModalTrigger>
|
<ModalTrigger>
|
||||||
<Button>Delete</Button>
|
<Button variant="danger">Delete</Button>
|
||||||
<Modal title={formatMessage(labels.deleteWebsite)}>
|
<Modal title={formatMessage(labels.deleteWebsite)}>
|
||||||
{close => (
|
{close => (
|
||||||
<WebsiteDeleteForm websiteId={websiteId} onSave={handleDelete} onClose={close} />
|
<WebsiteDeleteForm websiteId={websiteId} onSave={handleDelete} onClose={close} />
|
||||||
)}
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
</ModalTrigger>
|
</ModalTrigger>
|
||||||
</FormRow>
|
</ActionForm>
|
||||||
</Form>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ import Link from 'next/link';
|
|||||||
import Page from 'components/layout/Page';
|
import Page from 'components/layout/Page';
|
||||||
import PageHeader from 'components/layout/PageHeader';
|
import PageHeader from 'components/layout/PageHeader';
|
||||||
import WebsiteEditForm from 'components/pages/settings/websites/WebsiteEditForm';
|
import WebsiteEditForm from 'components/pages/settings/websites/WebsiteEditForm';
|
||||||
import WebsiteReset from 'components/pages/settings/websites/WebsiteReset';
|
import WebsiteData from 'components/pages/settings/websites/WebsiteData';
|
||||||
import TrackingCode from 'components/pages/settings/websites/TrackingCode';
|
import TrackingCode from 'components/pages/settings/websites/TrackingCode';
|
||||||
import ShareUrl from 'components/pages/settings/websites/ShareUrl';
|
import ShareUrl from 'components/pages/settings/websites/ShareUrl';
|
||||||
import useApi from 'hooks/useApi';
|
import useApi from 'hooks/useApi';
|
||||||
@ -59,8 +59,8 @@ export default function WebsiteSettings({ websiteId }) {
|
|||||||
</Breadcrumbs>
|
</Breadcrumbs>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Link href={`/websites/${websiteId}`}>
|
<Link href={`/analytics/websites/${websiteId}`}>
|
||||||
<a>
|
<a target="_blank">
|
||||||
<Button variant="primary">
|
<Button variant="primary">
|
||||||
<Icon>
|
<Icon>
|
||||||
<Icons.External />
|
<Icons.External />
|
||||||
@ -81,7 +81,7 @@ export default function WebsiteSettings({ websiteId }) {
|
|||||||
)}
|
)}
|
||||||
{tab === 'tracking' && <TrackingCode websiteId={websiteId} data={values} />}
|
{tab === 'tracking' && <TrackingCode websiteId={websiteId} data={values} />}
|
||||||
{tab === 'share' && <ShareUrl websiteId={websiteId} data={values} onSave={handleSave} />}
|
{tab === 'share' && <ShareUrl websiteId={websiteId} data={values} onSave={handleSave} />}
|
||||||
{tab === 'data' && <WebsiteReset websiteId={websiteId} onSave={handleReset} />}
|
{tab === 'data' && <WebsiteData websiteId={websiteId} onSave={handleReset} />}
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,13 @@ export interface NextApiRequestAuth extends NextApiRequest {
|
|||||||
headers: any;
|
headers: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface User {
|
||||||
|
id: string;
|
||||||
|
username: string;
|
||||||
|
password?: string;
|
||||||
|
createdAt?: Date;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Website {
|
export interface Website {
|
||||||
id: string;
|
id: string;
|
||||||
userId: string;
|
userId: string;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "umami",
|
"name": "umami",
|
||||||
"version": "2.0.0-beta.3",
|
"version": "2.0.0-beta.4",
|
||||||
"description": "A simple, fast, privacy-focused alternative to Google Analytics.",
|
"description": "A simple, fast, privacy-focused alternative to Google Analytics.",
|
||||||
"author": "Mike Cao <mike@mikecao.com>",
|
"author": "Mike Cao <mike@mikecao.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -8,9 +8,9 @@ import {
|
|||||||
getRandomChars,
|
getRandomChars,
|
||||||
} from 'next-basics';
|
} from 'next-basics';
|
||||||
import redis from '@umami/redis-client';
|
import redis from '@umami/redis-client';
|
||||||
import { getUser, User } from 'queries';
|
import { getUser } from 'queries';
|
||||||
import { secret } from 'lib/crypto';
|
import { secret } from 'lib/crypto';
|
||||||
import { NextApiRequestQueryBody } from 'lib/types';
|
import { NextApiRequestQueryBody, User } from 'lib/types';
|
||||||
import { NextApiResponse } from 'next';
|
import { NextApiResponse } from 'next';
|
||||||
|
|
||||||
export interface LoginRequestBody {
|
export interface LoginRequestBody {
|
||||||
|
@ -7,6 +7,7 @@ export interface ConfigResponse {
|
|||||||
updatesDisabled: boolean;
|
updatesDisabled: boolean;
|
||||||
telemetryDisabled: boolean;
|
telemetryDisabled: boolean;
|
||||||
adminDisabled: boolean;
|
adminDisabled: boolean;
|
||||||
|
cloudMode: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async (req: NextApiRequest, res: NextApiResponse<ConfigResponse>) => {
|
export default async (req: NextApiRequest, res: NextApiResponse<ConfigResponse>) => {
|
||||||
@ -17,6 +18,7 @@ export default async (req: NextApiRequest, res: NextApiResponse<ConfigResponse>)
|
|||||||
updatesDisabled: !!process.env.DISABLE_UPDATES,
|
updatesDisabled: !!process.env.DISABLE_UPDATES,
|
||||||
telemetryDisabled: !!process.env.DISABLE_TELEMETRY,
|
telemetryDisabled: !!process.env.DISABLE_TELEMETRY,
|
||||||
adminDisabled: !!process.env.DISABLE_ADMIN,
|
adminDisabled: !!process.env.DISABLE_ADMIN,
|
||||||
|
cloudMode: true, //!!process.env.CLOUD_MODE,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
pages/api/me/index.ts
Normal file
13
pages/api/me/index.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { NextApiResponse } from 'next';
|
||||||
|
import { useAuth } from 'lib/middleware';
|
||||||
|
import { NextApiRequestQueryBody, User } from 'lib/types';
|
||||||
|
import { ok } from 'next-basics';
|
||||||
|
|
||||||
|
export default async (
|
||||||
|
req: NextApiRequestQueryBody<unknown, unknown>,
|
||||||
|
res: NextApiResponse<User>,
|
||||||
|
) => {
|
||||||
|
await useAuth(req, res);
|
||||||
|
|
||||||
|
return ok(res, req.auth.user);
|
||||||
|
};
|
@ -1,4 +1,4 @@
|
|||||||
import { NextApiRequestQueryBody } from 'lib/types';
|
import { NextApiRequestQueryBody, User } from 'lib/types';
|
||||||
import { canUpdateUser } from 'lib/auth';
|
import { canUpdateUser } from 'lib/auth';
|
||||||
import { useAuth } from 'lib/middleware';
|
import { useAuth } from 'lib/middleware';
|
||||||
import { NextApiResponse } from 'next';
|
import { NextApiResponse } from 'next';
|
||||||
@ -7,10 +7,11 @@ import {
|
|||||||
checkPassword,
|
checkPassword,
|
||||||
hashPassword,
|
hashPassword,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
|
forbidden,
|
||||||
ok,
|
ok,
|
||||||
unauthorized,
|
unauthorized,
|
||||||
} from 'next-basics';
|
} from 'next-basics';
|
||||||
import { getUser, updateUser, User } from 'queries';
|
import { getUser, updateUser } from 'queries';
|
||||||
|
|
||||||
export interface UserPasswordRequestQuery {
|
export interface UserPasswordRequestQuery {
|
||||||
id: string;
|
id: string;
|
||||||
@ -25,6 +26,10 @@ export default async (
|
|||||||
req: NextApiRequestQueryBody<UserPasswordRequestQuery, UserPasswordRequestBody>,
|
req: NextApiRequestQueryBody<UserPasswordRequestQuery, UserPasswordRequestBody>,
|
||||||
res: NextApiResponse<User>,
|
res: NextApiResponse<User>,
|
||||||
) => {
|
) => {
|
||||||
|
if (process.env.CLOUD_MODE) {
|
||||||
|
return forbidden(res);
|
||||||
|
}
|
||||||
|
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
|
||||||
const { currentPassword, newPassword } = req.body;
|
const { currentPassword, newPassword } = req.body;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import AppLayout from 'components/layout/AppLayout';
|
import AppLayout from 'components/layout/AppLayout';
|
||||||
import TestConsole from 'components/pages/console/TestConsole';
|
import TestConsole from 'components/pages/console/TestConsole';
|
||||||
|
|
||||||
export default function ConsolePage({ pageDisabled }) {
|
export default function ConsolePage({ disabled }) {
|
||||||
if (pageDisabled) {
|
if (disabled) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ export default function ConsolePage({ pageDisabled }) {
|
|||||||
export async function getServerSideProps() {
|
export async function getServerSideProps() {
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
pageDisabled: !process.env.ENABLE_TEST_CONSOLE,
|
disabled: !process.env.ENABLE_TEST_CONSOLE,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import LoginLayout from 'components/pages/login/LoginLayout';
|
import LoginLayout from 'components/pages/login/LoginLayout';
|
||||||
import LoginForm from 'components/pages/login/LoginForm';
|
import LoginForm from 'components/pages/login/LoginForm';
|
||||||
|
|
||||||
export default function LoginPage({ pageDisabled }) {
|
export default function LoginPage({ disabled }) {
|
||||||
if (pageDisabled) {
|
if (disabled) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ export default function LoginPage({ pageDisabled }) {
|
|||||||
export async function getServerSideProps() {
|
export async function getServerSideProps() {
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
pageDisabled: !!process.env.DISABLE_LOGIN,
|
disabled: !!(process.env.DISABLE_LOGIN || process.env.CLOUD_MODE),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import useApi from 'hooks/useApi';
|
|||||||
import { setUser } from 'store/app';
|
import { setUser } from 'store/app';
|
||||||
import { removeClientAuthToken } from 'lib/client';
|
import { removeClientAuthToken } from 'lib/client';
|
||||||
|
|
||||||
export default function LogoutPage() {
|
export default function LogoutPage({ disabled }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { post } = useApi();
|
const { post } = useApi();
|
||||||
|
|
||||||
@ -13,14 +13,24 @@ export default function LogoutPage() {
|
|||||||
await post('/logout');
|
await post('/logout');
|
||||||
}
|
}
|
||||||
|
|
||||||
removeClientAuthToken();
|
if (!disabled) {
|
||||||
|
removeClientAuthToken();
|
||||||
|
|
||||||
logout();
|
logout();
|
||||||
|
|
||||||
router.push('/login');
|
router.push('/login');
|
||||||
|
|
||||||
return () => setUser(null);
|
return () => setUser(null);
|
||||||
}, []);
|
}
|
||||||
|
}, [disabled, router, post]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps() {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
disabled: !!(process.env.DISABLE_LOGIN || process.env.CLOUD_MODE),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
export default () => null;
|
export default () => null;
|
||||||
|
|
||||||
export async function getServerSideProps() {
|
export async function getServerSideProps() {
|
||||||
|
const destination = process.env.CLOUD_MODE ? 'https://cloud.umami.is' : '/settings/websites';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
destination: '/settings/websites',
|
destination,
|
||||||
permanent: true,
|
permanent: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -2,13 +2,25 @@ import AppLayout from 'components/layout/AppLayout';
|
|||||||
import TeamSettings from 'components/pages/settings/teams/TeamSettings';
|
import TeamSettings from 'components/pages/settings/teams/TeamSettings';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
|
|
||||||
export default function TeamDetailPage() {
|
export default function TeamDetailPage({ disabled }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { id } = router.query;
|
const { id } = router.query;
|
||||||
|
|
||||||
|
if (!id || disabled) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppLayout>
|
<AppLayout>
|
||||||
<TeamSettings teamId={id} />
|
<TeamSettings teamId={id} />
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps() {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
disabled: !!process.env.CLOUD_MODE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -1,10 +1,22 @@
|
|||||||
import AppLayout from 'components/layout/AppLayout';
|
import AppLayout from 'components/layout/AppLayout';
|
||||||
import TeamsList from 'components/pages/settings/teams/TeamsList';
|
import TeamsList from 'components/pages/settings/teams/TeamsList';
|
||||||
|
|
||||||
export default function TeamsPage() {
|
export default function TeamsPage({ disabled }) {
|
||||||
|
if (disabled) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppLayout>
|
<AppLayout>
|
||||||
<TeamsList />
|
<TeamsList />
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps() {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
disabled: !!process.env.CLOUD_MODE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -2,13 +2,25 @@ import AppLayout from 'components/layout/AppLayout';
|
|||||||
import UserSettings from 'components/pages/settings/users/UserSettings';
|
import UserSettings from 'components/pages/settings/users/UserSettings';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
|
|
||||||
export default function TeamDetailPage() {
|
export default function TeamDetailPage({ disabled }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { id } = router.query;
|
const { id } = router.query;
|
||||||
|
|
||||||
|
if (!id || disabled) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppLayout>
|
<AppLayout>
|
||||||
<UserSettings userId={id} />
|
<UserSettings userId={id} />
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps() {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
disabled: !!process.env.CLOUD_MODE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
import AppLayout from 'components/layout/AppLayout';
|
import AppLayout from 'components/layout/AppLayout';
|
||||||
import useConfig from 'hooks/useConfig';
|
|
||||||
|
|
||||||
import UsersList from 'components/pages/settings/users/UsersList';
|
import UsersList from 'components/pages/settings/users/UsersList';
|
||||||
|
|
||||||
export default function UsersPage() {
|
export default function UsersPage({ disabled }) {
|
||||||
const { adminDisabled } = useConfig();
|
if (disabled) {
|
||||||
|
|
||||||
if (adminDisabled) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,3 +12,11 @@ export default function UsersPage() {
|
|||||||
</AppLayout>
|
</AppLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps() {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
disabled: !!process.env.CLOUD_MODE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -2,11 +2,11 @@ import { useRouter } from 'next/router';
|
|||||||
import WebsiteSettings from 'components/pages/settings/websites/WebsiteSettings';
|
import WebsiteSettings from 'components/pages/settings/websites/WebsiteSettings';
|
||||||
import AppLayout from 'components/layout/AppLayout';
|
import AppLayout from 'components/layout/AppLayout';
|
||||||
|
|
||||||
export default function WebsiteSettingsPage() {
|
export default function WebsiteSettingsPage({ disabled }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { id } = router.query;
|
const { id } = router.query;
|
||||||
|
|
||||||
if (!id) {
|
if (!id || disabled) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,3 +16,11 @@ export default function WebsiteSettingsPage() {
|
|||||||
</AppLayout>
|
</AppLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps() {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
disabled: !!process.env.CLOUD_MODE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -1,10 +1,22 @@
|
|||||||
import AppLayout from 'components/layout/AppLayout';
|
import AppLayout from 'components/layout/AppLayout';
|
||||||
import WebsitesList from 'components/pages/settings/websites/WebsitesList';
|
import WebsitesList from 'components/pages/settings/websites/WebsitesList';
|
||||||
|
|
||||||
export default function WebsitesPage() {
|
export default function WebsitesPage({ disabled }) {
|
||||||
|
if (disabled) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppLayout>
|
<AppLayout>
|
||||||
<WebsitesList />
|
<WebsitesList />
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps() {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
disabled: !!process.env.CLOUD_MODE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
import { Prisma, Team } from '@prisma/client';
|
import { Prisma, Team } from '@prisma/client';
|
||||||
import cache from 'lib/cache';
|
import cache from 'lib/cache';
|
||||||
import prisma from 'lib/prisma';
|
import prisma from 'lib/prisma';
|
||||||
import { Website } from 'lib/types';
|
import { Website, User } from 'lib/types';
|
||||||
|
|
||||||
export interface User {
|
|
||||||
id: string;
|
|
||||||
username: string;
|
|
||||||
password?: string;
|
|
||||||
createdAt?: Date;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getUser(
|
export async function getUser(
|
||||||
where: Prisma.UserWhereUniqueInput,
|
where: Prisma.UserWhereUniqueInput,
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
html {
|
||||||
|
overflow-x: hidden;
|
||||||
|
margin-right: calc(-1 * (100vw - 100%));
|
||||||
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
font-family: Inter, -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans,
|
font-family: Inter, -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans,
|
||||||
|
Loading…
Reference in New Issue
Block a user