fixes and improvements

This commit is contained in:
daniel31x13
2023-12-04 10:24:45 -05:00
parent ee05975e10
commit 1f20180a51
15 changed files with 75 additions and 35 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ export default function App({
reverseOrder={false}
toastOptions={{
className:
"border border-sky-100 dark:border-neutral-700 dark:bg-neutral-900 dark:text-white",
"border border-sky-100 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",
}}
/>
<Component {...pageProps} />
+21 -9
View File
@@ -89,8 +89,6 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
});
form.parse(req, async (err, fields, files) => {
console.log(files);
const allowedMIMETypes = [
"application/pdf",
"image/png",
@@ -109,17 +107,31 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
response: `Sorry, we couldn't process your file. Please ensure it's a PDF, PNG, or JPG format and doesn't exceed ${MAX_UPLOAD_SIZE}MB.`,
});
} else {
console.log(files.file[0].mimetype);
const fileBuffer = fs.readFileSync(files.file[0].filepath);
console.log(fileBuffer);
await createFile({
filePath: `archives/${collectionPermissions?.id}/${linkId + suffix}`,
data: fileBuffer,
const linkStillExists = await prisma.link.findUnique({
where: { id: linkId },
});
if (linkStillExists) {
await createFile({
filePath: `archives/${collectionPermissions?.id}/${
linkId + suffix
}`,
data: fileBuffer,
});
await prisma.link.update({
where: { id: linkId },
data: {
screenshotPath: `archives/${collectionPermissions?.id}/${
linkId + suffix
}`,
lastPreserved: new Date().toISOString(),
},
});
}
fs.unlinkSync(files.file[0].filepath);
}
+1 -1
View File
@@ -133,7 +133,7 @@ export default function Index() {
</div>
) : null}
</div>
<p className="text-neutral text-xs">
<p className="text-neutral text-sm font-semibold">
By {collectionOwner.name}
{activeCollection.members.length > 0
? ` and ${activeCollection.members.length} others`
+1 -1
View File
@@ -169,7 +169,7 @@ export default function PublicCollections() {
) : null}
</div>
<p className="text-neutral text-xs">
<p className="text-neutral text-sm font-semibold">
By {collectionOwner.name}
{collection.members.length > 0
? ` and ${collection.members.length} others`