This commit is contained in:
daniel31x13
2025-10-15 06:49:45 -04:00
parent 7d45249e8f
commit 0907c3caa2
2 changed files with 16 additions and 3 deletions

View File

@@ -162,6 +162,11 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {
},
},
url,
// temporarily prevent archiveHandler and other processes from overwriting the file while we're uploading it
lastPreserved: new Date(0).toISOString(),
aiTagged: true,
indexVersion: 1,
},
});
@@ -203,6 +208,10 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {
: undefined,
clientSide: true,
updatedAt: new Date().toISOString(),
lastPreserved: null,
aiTagged: false,
indexVersion: null,
},
});

View File

@@ -120,7 +120,7 @@ export default async function archiveHandler(
await page.goto(link.url, { waitUntil: "domcontentloaded" });
// Handle Monolith being sent in beforehand while making sure other values line up
if (link.monolith) {
if (link.monolith?.endsWith(".html")) {
// Use Monolith content instead of page
const file = await readFile(link.monolith);
@@ -128,9 +128,13 @@ export default async function archiveHandler(
const fileContent = file.file;
if (typeof fileContent === "string") {
await page.setContent(fileContent, { waitUntil: "domcontentloaded" });
await page.setContent(fileContent, {
waitUntil: "domcontentloaded",
});
} else {
await page.setContent(fileContent.toString("utf-8"), { waitUntil: "domcontentloaded" });
await page.setContent(fileContent.toString("utf-8"), {
waitUntil: "domcontentloaded",
});
}
}
}