added rearchive functionallity + dropdown fix [WIP]

This commit is contained in:
daniel31x13
2023-10-28 05:57:53 -04:00
parent 9b6038201c
commit ac795cdbdc
6 changed files with 169 additions and 62 deletions
+26 -2
View File
@@ -14,6 +14,16 @@ export default async function archive(
},
});
const link = await prisma.link.update({
where: {
id: linkId,
},
data: {
screenshotPath: "pending",
pdfPath: "pending",
},
});
if (user?.archiveAsWaybackMachine) sendToWayback(url);
if (user?.archiveAsPDF || user?.archiveAsScreenshot) {
@@ -41,7 +51,7 @@ export default async function archive(
fullPage: true,
});
createFile({
await createFile({
data: screenshot,
filePath: `archives/${linkExists.collectionId}/${linkId}.png`,
});
@@ -55,11 +65,25 @@ export default async function archive(
margin: { top: "15px", bottom: "15px" },
});
createFile({
await createFile({
data: pdf,
filePath: `archives/${linkExists.collectionId}/${linkId}.pdf`,
});
}
const updateLink = await prisma.link.update({
where: {
id: linkId,
},
data: {
screenshotPath: user.archiveAsScreenshot
? `archives/${linkExists.collectionId}/${linkId}.png`
: null,
pdfPath: user.archiveAsPDF
? `archives/${linkExists.collectionId}/${linkId}.pdf`
: null,
},
});
}
await browser.close();