parent
402987baba
commit
41b766216e
9 changed files with 20 additions and 10 deletions
|
@ -80,4 +80,4 @@
|
||||||
"url": "https://github.com/diced/zipline.git"
|
"url": "https://github.com/diced/zipline.git"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@3.2.1"
|
"packageManager": "yarn@3.2.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { showNotification } from '@mantine/notifications';
|
||||||
import { relativeTime } from 'lib/utils/client';
|
import { relativeTime } from 'lib/utils/client';
|
||||||
import { useFileDelete, useFileFavorite } from 'lib/queries/files';
|
import { useFileDelete, useFileFavorite } from 'lib/queries/files';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { CalendarIcon, ClockIcon, CopyIcon, CrossIcon, DeleteIcon, ExternalLinkIcon, FileIcon, HashIcon, ImageIcon, StarIcon } from './icons';
|
import { CalendarIcon, ClockIcon, CopyIcon, CrossIcon, DeleteIcon, ExternalLinkIcon, FileIcon, HashIcon, ImageIcon, StarIcon, EyeIcon } from './icons';
|
||||||
import MutedText from './MutedText';
|
import MutedText from './MutedText';
|
||||||
import Type from './Type';
|
import Type from './Type';
|
||||||
import Link from './Link';
|
import Link from './Link';
|
||||||
|
@ -96,6 +96,7 @@ export default function File({ image, updateImages, disableMediaPreview }) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(image);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -118,6 +119,7 @@ export default function File({ image, updateImages, disableMediaPreview }) {
|
||||||
<Stack>
|
<Stack>
|
||||||
<FileMeta Icon={FileIcon} title='Name' subtitle={image.file} />
|
<FileMeta Icon={FileIcon} title='Name' subtitle={image.file} />
|
||||||
<FileMeta Icon={ImageIcon} title='Type' subtitle={image.mimetype} />
|
<FileMeta Icon={ImageIcon} title='Type' subtitle={image.mimetype} />
|
||||||
|
<FileMeta Icon={EyeIcon} title='Views' subtitle={image.views} />
|
||||||
<FileMeta Icon={CalendarIcon} title='Uploaded at' subtitle={new Date(image.created_at).toLocaleString()} />
|
<FileMeta Icon={CalendarIcon} title='Uploaded at' subtitle={new Date(image.created_at).toLocaleString()} />
|
||||||
{image.expires_at && <FileMeta
|
{image.expires_at && <FileMeta
|
||||||
Icon={ClockIcon}
|
Icon={ClockIcon}
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default function Dropzone({ loading, onDrop, children }) {
|
||||||
<ImageIcon size={80} />
|
<ImageIcon size={80} />
|
||||||
|
|
||||||
<Text size='xl' inline>
|
<Text size='xl' inline>
|
||||||
Drag images here or click to select files
|
Drag files here or click to select files
|
||||||
</Text>
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
|
|
5
src/components/icons/EyeIcon.tsx
Normal file
5
src/components/icons/EyeIcon.tsx
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import { Eye } from 'react-feather';
|
||||||
|
|
||||||
|
export default function EyeIcon({ ...props }) {
|
||||||
|
return <Eye size={15} {...props} />;
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ import DownloadIcon from './DownloadIcon';
|
||||||
import FlameshotIcon from './FlameshotIcon';
|
import FlameshotIcon from './FlameshotIcon';
|
||||||
import GitHubIcon from './GitHubIcon';
|
import GitHubIcon from './GitHubIcon';
|
||||||
import DiscordIcon from './DiscordIcon';
|
import DiscordIcon from './DiscordIcon';
|
||||||
|
import EyeIcon from './EyeIcon';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
ActivityIcon,
|
ActivityIcon,
|
||||||
|
@ -62,4 +63,5 @@ export {
|
||||||
FlameshotIcon,
|
FlameshotIcon,
|
||||||
GitHubIcon,
|
GitHubIcon,
|
||||||
DiscordIcon,
|
DiscordIcon,
|
||||||
|
EyeIcon,
|
||||||
};
|
};
|
|
@ -202,7 +202,7 @@ export default function Manage() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const openDeleteModal = () => modals.openConfirmModal({
|
const openDeleteModal = () => modals.openConfirmModal({
|
||||||
title: 'Are you sure you want to delete all of your images?',
|
title: 'Are you sure you want to delete all of your files?',
|
||||||
closeOnConfirm: false,
|
closeOnConfirm: false,
|
||||||
labels: { confirm: 'Yes', cancel: 'No' },
|
labels: { confirm: 'Yes', cancel: 'No' },
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default function Upload() {
|
||||||
|
|
||||||
showNotification({
|
showNotification({
|
||||||
id: 'upload',
|
id: 'upload',
|
||||||
title: 'Uploading Images...',
|
title: 'Uploading files...',
|
||||||
message: '',
|
message: '',
|
||||||
loading: true,
|
loading: true,
|
||||||
autoClose: false,
|
autoClose: false,
|
||||||
|
@ -123,7 +123,7 @@ export default function Upload() {
|
||||||
updateNotification({
|
updateNotification({
|
||||||
id: 'upload',
|
id: 'upload',
|
||||||
title: 'Upload Successful',
|
title: 'Upload Successful',
|
||||||
message: <>Copied first image to clipboard! <br />{json.files.map(x => (<Link key={x} href={x}>{x}<br /></Link>))}</>,
|
message: <>Copied first file to clipboard! <br />{json.files.map(x => (<Link key={x} href={x}>{x}<br /></Link>))}</>,
|
||||||
color: 'green',
|
color: 'green',
|
||||||
icon: <UploadIcon />,
|
icon: <UploadIcon />,
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,7 +25,7 @@ async function handler(req: NextApiReq, res: NextApiRes) {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Logger.get('image').info(`User ${user.username} (${user.id}) deleted ${count} images.`);
|
Logger.get('image').info(`User ${user.username} (${user.id}) deleted ${count} files.`);
|
||||||
|
|
||||||
return res.json({ count });
|
return res.json({ count });
|
||||||
} else {
|
} else {
|
||||||
|
@ -74,14 +74,15 @@ async function handler(req: NextApiReq, res: NextApiRes) {
|
||||||
mimetype: true,
|
mimetype: true,
|
||||||
id: true,
|
id: true,
|
||||||
favorite: true,
|
favorite: true,
|
||||||
|
views: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
images.map(image => image.url = `/r/${image.file}`);
|
images.map(image => image.url = `/r/${image.file}`);
|
||||||
if (req.query.filter && req.query.filter === 'media') images = images.filter(x => /^(video|audio|image|text)/.test(x.mimetype));
|
if (req.query.filter && req.query.filter === 'media') images = images.filter(x => /^(video|audio|image|text)/.test(x.mimetype));
|
||||||
|
|
||||||
return res.json(req.query.paged ? chunk(images, 16) : images);
|
return res.json(req.query.paged ? chunk(images, 16) : images);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ async function handler(req: NextApiReq, res: NextApiRes) {
|
||||||
userId: deleteUser.id,
|
userId: deleteUser.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Logger.get('image').info(`User ${user.username} (${user.id}) deleted ${count} images of user ${deleteUser.username} (${deleteUser.id})`);
|
Logger.get('image').info(`User ${user.username} (${user.id}) deleted ${count} files of user ${deleteUser.username} (${deleteUser.id})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await prisma.user.delete({
|
await prisma.user.delete({
|
||||||
|
|
Loading…
Reference in a new issue