code formatter + add maskable icon

This commit is contained in:
daniel31x13 2024-03-24 00:36:42 -04:00
parent 5fe6a5b19a
commit 6d7d364853
2 changed files with 28 additions and 11 deletions

View File

@ -120,7 +120,10 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
const content = await page.content(); const content = await page.content();
// Singlefile // Singlefile
if (user.archiveAsSinglefile && !link.singlefile?.startsWith("archive")) { if (
user.archiveAsSinglefile &&
!link.singlefile?.startsWith("archive")
) {
let command = process.env.SINGLEFILE_ARCHIVE_COMMAND; let command = process.env.SINGLEFILE_ARCHIVE_COMMAND;
let httpApi = process.env.SINGLEFILE_ARCHIVE_HTTP_API; let httpApi = process.env.SINGLEFILE_ARCHIVE_HTTP_API;
if (command) { if (command) {
@ -135,28 +138,42 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) {
filePath: `archives/${targetLink.collectionId}/${link.id}.html`, filePath: `archives/${targetLink.collectionId}/${link.id}.html`,
}); });
} catch (err) { } catch (err) {
console.error("Error running SINGLEFILE_ARCHIVE_COMMAND:", err); console.error(
"Error running SINGLEFILE_ARCHIVE_COMMAND:",
err
);
} }
} else { } else {
console.error("Invalid SINGLEFILE_ARCHIVE_COMMAND. Missing {{URL}}"); console.error(
"Invalid SINGLEFILE_ARCHIVE_COMMAND. Missing {{URL}}"
);
} }
} else if (httpApi) { } else if (httpApi) {
try { try {
let html = await axios.post(httpApi, { url: link.url }, { let html = await axios.post(
httpApi,
{ url: link.url },
{
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' "Content-Type": "application/x-www-form-urlencoded",
}, },
httpAgent: new Agent({ keepAlive: false }), httpAgent: new Agent({ keepAlive: false }),
}); }
);
await createFile({ await createFile({
data: html.data, data: html.data,
filePath: `archives/${targetLink.collectionId}/${link.id}.html`, filePath: `archives/${targetLink.collectionId}/${link.id}.html`,
}); });
} catch (err) { } catch (err) {
console.error("Error fetching Singlefile using SINGLEFILE_ARCHIVE_HTTP_API:", err); console.error(
"Error fetching Singlefile using SINGLEFILE_ARCHIVE_HTTP_API:",
err
);
} }
} else { } else {
console.error("No SINGLEFILE_ARCHIVE_COMMAND or SINGLEFILE_ARCHIVE_HTTP_API defined."); console.error(
"No SINGLEFILE_ARCHIVE_COMMAND or SINGLEFILE_ARCHIVE_HTTP_API defined."
);
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 87 KiB