feat(3.4.8): fix bug where you can crash zipline
This commit is contained in:
parent
38eef3f0ad
commit
ea27fd8a45
7 changed files with 59 additions and 59 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -42,5 +42,4 @@ yarn-error.log*
|
|||
# zipline
|
||||
config.toml
|
||||
uploads/
|
||||
dist/
|
||||
docker-compose.local.yml
|
||||
dist/
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "zipline",
|
||||
"version": "3.4.7",
|
||||
"version": "3.4.8",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "node esbuild.config.js && REACT_EDITOR=code NODE_ENV=development node dist/server",
|
||||
|
|
|
@ -1,25 +1,23 @@
|
|||
import React from 'react';
|
||||
import { Box, Button, Stack, Text, Title } from '@mantine/core';
|
||||
import { Button, Stack, Title } from '@mantine/core';
|
||||
import Link from 'components/Link';
|
||||
import MutedText from 'components/MutedText';
|
||||
|
||||
export default function FourOhFour() {
|
||||
return (
|
||||
<>
|
||||
<Stack
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
minHeight: '100vh',
|
||||
justifyContent: 'center',
|
||||
position: 'relative',
|
||||
}}
|
||||
spacing='sm'
|
||||
>
|
||||
<Title sx={{ fontSize: 220, fontWeight: 900, lineHeight: .8 }}>404</Title>
|
||||
<MutedText sx={{ fontSize: 40, fontWeight: 500 }}>This page does not exist!</MutedText>
|
||||
<Button component={Link} href='/dashboard'>Head to the Dashboard</Button>
|
||||
</Stack>
|
||||
</>
|
||||
<Stack
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
minHeight: '100vh',
|
||||
justifyContent: 'center',
|
||||
position: 'relative',
|
||||
}}
|
||||
spacing='sm'
|
||||
>
|
||||
<Title sx={{ fontSize: 220, fontWeight: 900, lineHeight: .8 }}>404</Title>
|
||||
<MutedText sx={{ fontSize: 40, fontWeight: 500 }}>This page does not exist!</MutedText>
|
||||
<Button component={Link} href='/dashboard'>Head to the Dashboard</Button>
|
||||
</Stack>
|
||||
);
|
||||
}
|
|
@ -5,21 +5,19 @@ import MutedText from 'components/MutedText';
|
|||
|
||||
export default function FiveHundred() {
|
||||
return (
|
||||
<>
|
||||
<Stack
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
minHeight: '100vh',
|
||||
justifyContent: 'center',
|
||||
position: 'relative',
|
||||
}}
|
||||
spacing='sm'
|
||||
>
|
||||
<Title sx={{ fontSize: 220, fontWeight: 900, lineHeight: .8 }}>500</Title>
|
||||
<MutedText sx={{ fontSize: 40, fontWeight: 500 }}>Internal Server Error</MutedText>
|
||||
<Button component={Link} href='/dashboard'>Head to the Dashboard</Button>
|
||||
</Stack>
|
||||
</>
|
||||
<Stack
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
minHeight: '100vh',
|
||||
justifyContent: 'center',
|
||||
position: 'relative',
|
||||
}}
|
||||
spacing='sm'
|
||||
>
|
||||
<Title sx={{ fontSize: 220, fontWeight: 900, lineHeight: .8 }}>500</Title>
|
||||
<MutedText sx={{ fontSize: 40, fontWeight: 500 }}>Internal Server Error</MutedText>
|
||||
<Button component={Link} href='/dashboard'>Head to the Dashboard</Button>
|
||||
</Stack>
|
||||
);
|
||||
}
|
|
@ -9,6 +9,7 @@ export default function MyApp({ Component, pageProps }) {
|
|||
<Provider store={store}>
|
||||
<Head>
|
||||
<title>{Component.title}</title>
|
||||
<meta name='viewport' content='minimum-scale=1, initial-scale=1, width=device-width' />
|
||||
</Head>
|
||||
<ZiplineTheming Component={Component} pageProps={pageProps} />
|
||||
</Provider>
|
||||
|
|
|
@ -5,22 +5,20 @@ import MutedText from 'components/MutedText';
|
|||
|
||||
export default function Error({ statusCode }) {
|
||||
return (
|
||||
<>
|
||||
<Stack
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
minHeight: '100vh',
|
||||
justifyContent: 'center',
|
||||
position: 'relative',
|
||||
}}
|
||||
spacing='sm'
|
||||
>
|
||||
<Title sx={{ fontSize: 220, fontWeight: 900, lineHeight: .8 }}>{statusCode}</Title>
|
||||
<MutedText sx={{ fontSize: 40, fontWeight: 500 }}>Something went wrong...</MutedText>
|
||||
<Button component={Link} href='/dashboard'>Head to the Dashboard</Button>
|
||||
</Stack>
|
||||
</>
|
||||
<Stack
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
minHeight: '100vh',
|
||||
justifyContent: 'center',
|
||||
position: 'relative',
|
||||
}}
|
||||
spacing='sm'
|
||||
>
|
||||
<Title sx={{ fontSize: 220, fontWeight: 900, lineHeight: .8 }}>{statusCode}</Title>
|
||||
<MutedText sx={{ fontSize: 40, fontWeight: 500 }}>Something went wrong...</MutedText>
|
||||
<Button component={Link} href='/dashboard'>Head to the Dashboard</Button>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,8 @@ async function start() {
|
|||
});
|
||||
|
||||
router.on('GET', config.uploader.route === '/' ? '/:id(^[^\\.]+\\.[^\\.]+)' : `${config.uploader.route}/:id`, async (req, res, params) => {
|
||||
if (params.id === '') return nextServer.render404(req, res as ServerResponse);
|
||||
|
||||
const image = await prisma.image.findFirst({
|
||||
where: {
|
||||
OR: [
|
||||
|
@ -75,13 +77,16 @@ async function start() {
|
|||
});
|
||||
|
||||
if (!image) await rawFile(req, res, nextServer, params.id);
|
||||
|
||||
if (image.password) await handle(req, res);
|
||||
else if (image.embed) await handle(req, res);
|
||||
else await fileDb(req, res, nextServer, prisma, handle, image);
|
||||
else {
|
||||
if (image.password) await handle(req, res);
|
||||
else if (image.embed) await handle(req, res);
|
||||
else await fileDb(req, res, nextServer, prisma, handle, image);
|
||||
}
|
||||
});
|
||||
|
||||
router.on('GET', '/r/:id', async (req, res, params) => {
|
||||
if (params.id === '') return nextServer.render404(req, res as ServerResponse);
|
||||
|
||||
const image = await prisma.image.findFirst({
|
||||
where: {
|
||||
OR: [
|
||||
|
@ -92,9 +97,10 @@ async function start() {
|
|||
});
|
||||
|
||||
if (!image) await rawFile(req, res, nextServer, params.id);
|
||||
|
||||
if (image.password) await handle(req, res);
|
||||
else await rawFileDb(req, res, nextServer, prisma, image);
|
||||
else {
|
||||
if (image.password) await handle(req, res);
|
||||
else await rawFileDb(req, res, nextServer, prisma, image);
|
||||
}
|
||||
});
|
||||
|
||||
await nextServer.prepare();
|
||||
|
|
Loading…
Reference in a new issue