webpages can now be a image or pdf

This commit is contained in:
daniel31x13
2023-11-25 03:19:02 -05:00
parent 676c7c3a5d
commit b88fa446be
12 changed files with 156 additions and 15 deletions
+7 -4
View File
@@ -76,8 +76,7 @@ export default function PreservedFormats() {
// Create a temporary link and click it to trigger the download
const link = document.createElement("a");
link.href = path;
link.download =
format === ArchivedFormat.screenshot ? "Screenshot" : "PDF";
link.download = format === ArchivedFormat.png ? "Screenshot" : "PDF";
link.click();
} else {
console.error("Failed to download file");
@@ -102,7 +101,7 @@ export default function PreservedFormats() {
<div className="flex text-black dark:text-white gap-1">
<div
onClick={() => handleDownload(ArchivedFormat.screenshot)}
onClick={() => handleDownload(ArchivedFormat.png)}
className="cursor-pointer hover:opacity-60 duration-100 p-2 rounded-md"
>
<FontAwesomeIcon
@@ -112,7 +111,11 @@ export default function PreservedFormats() {
</div>
<Link
href={`/api/v1/archives/${link?.id}?format=${ArchivedFormat.screenshot}`}
href={`/api/v1/archives/${link?.id}?format=${
link.screenshotPath.endsWith("png")
? ArchivedFormat.png
: ArchivedFormat.jpeg
}`}
target="_blank"
className="cursor-pointer hover:opacity-60 duration-100 p-2 rounded-md"
>