Merge branch 'dev' into feat/um-49-query-builder-api
commit
517f7ff2c2
|
@ -38,9 +38,11 @@ export default function Header() {
|
|||
<Link href="/realtime">
|
||||
<FormattedMessage id="label.realtime" defaultMessage="Realtime" />
|
||||
</Link>
|
||||
<Link href="/settings">
|
||||
<FormattedMessage id="label.settings" defaultMessage="Settings" />
|
||||
</Link>
|
||||
{!process.env.isCloudMode && (
|
||||
<Link href="/settings">
|
||||
<FormattedMessage id="label.settings" defaultMessage="Settings" />
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.buttons}>
|
||||
|
|
|
@ -25,7 +25,11 @@ export default function UserButton() {
|
|||
value: 'username',
|
||||
className: styles.username,
|
||||
},
|
||||
{ label: <FormattedMessage id="label.profile" defaultMessage="Profile" />, value: 'profile' },
|
||||
{
|
||||
label: <FormattedMessage id="label.profile" defaultMessage="Profile" />,
|
||||
value: 'profile',
|
||||
hidden: process.env.isCloudMode,
|
||||
},
|
||||
{ label: <FormattedMessage id="label.logout" defaultMessage="Logout" />, value: 'logout' },
|
||||
];
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ module.exports = {
|
|||
env: {
|
||||
currentVersion: pkg.version,
|
||||
isProduction: process.env.NODE_ENV === 'production',
|
||||
isCloudMode: process.env.CLOUD_MODE,
|
||||
},
|
||||
basePath: process.env.BASE_PATH,
|
||||
output: 'standalone',
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@fontsource/inter": "4.5.7",
|
||||
"@prisma/client": "4.3.1",
|
||||
"@prisma/client": "4.4.0",
|
||||
"chalk": "^4.1.1",
|
||||
"chart.js": "^2.9.4",
|
||||
"classnames": "^2.3.1",
|
||||
|
@ -84,7 +84,7 @@
|
|||
"maxmind": "^4.3.6",
|
||||
"moment-timezone": "^0.5.35",
|
||||
"next": "^12.2.5",
|
||||
"next-basics": "^0.17.0",
|
||||
"next-basics": "^0.18.0",
|
||||
"node-fetch": "^3.2.8",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prop-types": "^15.7.2",
|
||||
|
@ -125,7 +125,7 @@
|
|||
"postcss-preset-env": "7.4.3",
|
||||
"postcss-rtlcss": "^3.6.1",
|
||||
"prettier": "^2.6.2",
|
||||
"prisma": "4.3.1",
|
||||
"prisma": "4.4.0",
|
||||
"prompts": "2.4.2",
|
||||
"rollup": "^2.70.1",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { allowQuery } from 'lib/auth';
|
||||
import { useAuth, useCors } from 'lib/middleware';
|
||||
import { getRandomChars, methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { getRandomChars, methodNotAllowed, ok, serverError, unauthorized } from 'next-basics';
|
||||
import { deleteWebsite, getAccount, getWebsite, updateWebsite } from 'queries';
|
||||
|
||||
export default async (req, res) => {
|
||||
|
@ -26,21 +26,31 @@ export default async (req, res) => {
|
|||
|
||||
if (accountUuid) {
|
||||
account = await getAccount({ accountUuid });
|
||||
|
||||
if (!account) {
|
||||
return serverError(res, 'Account does not exist.');
|
||||
}
|
||||
}
|
||||
|
||||
const website = await getWebsite({ websiteUuid: websiteId });
|
||||
|
||||
const newShareId = enableShareUrl ? website.shareId || getRandomChars(8) : null;
|
||||
|
||||
await updateWebsite(
|
||||
{
|
||||
name,
|
||||
domain,
|
||||
shareId: shareId ? shareId : newShareId,
|
||||
userId: account ? account.id : +owner,
|
||||
},
|
||||
{ websiteUuid: websiteId },
|
||||
);
|
||||
try {
|
||||
await updateWebsite(
|
||||
{
|
||||
name,
|
||||
domain,
|
||||
shareId: shareId ? shareId : newShareId,
|
||||
userId: account ? account.id : +owner || undefined,
|
||||
},
|
||||
{ websiteUuid: websiteId },
|
||||
);
|
||||
} catch (e) {
|
||||
if (e.message.includes('Unique constraint') && e.message.includes('share_id')) {
|
||||
return serverError(res, 'That share ID is already taken.');
|
||||
}
|
||||
}
|
||||
|
||||
return ok(res);
|
||||
}
|
||||
|
|
|
@ -18,9 +18,3 @@ export default function ConsolePage({ enabled }) {
|
|||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: { enabled: !!process.env.ENABLE_TEST_CONSOLE },
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,6 +16,6 @@ export default function LoginPage({ loginDisabled }) {
|
|||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: { loginDisabled: !!process.env.DISABLE_LOGIN },
|
||||
props: { loginDisabled: !!process.env.DISABLE_LOGIN || process.env.isCloudMode },
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import useRequireLogin from 'hooks/useRequireLogin';
|
|||
export default function SettingsPage() {
|
||||
const { loading } = useRequireLogin();
|
||||
|
||||
if (loading) {
|
||||
if (process.env.isCloudMode || loading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue