Add labels to icons and add 'Party Trick'

This commit is contained in:
Bad Manners 2025-01-02 11:23:24 -03:00
parent 9569420386
commit 477ef638cc
No known key found for this signature in database
GPG key ID: 8C88292CCB075609
12 changed files with 581 additions and 191 deletions

View file

@ -83,7 +83,7 @@ async function exportStory(id: string, options: { outputDir: string }) {
lines.on("close", reject);
});
console.log(`Astro listening on ${astroURL}`);
const response = await fetchRetry(new URL(`api/healthcheck`, astroURL), { retries: 5, retryDelay: 2000 });
const response = await fetchRetry(new URL(`/api/healthcheck`, astroURL), { retries: 5, retryDelay: 2000 });
if (!response.ok) {
throw new Error(response.statusText);
}
@ -103,7 +103,11 @@ async function exportStory(id: string, options: { outputDir: string }) {
let storyText = "";
try {
console.log("Getting data from Astro...");
const response = await fetch(new URL(`api/export-story/${id}`, astroURL));
const response = await fetchRetry(new URL(`/api/export-story/${id}`, astroURL), {
retries: 5,
retryDelay: 1000,
retryOn: [404],
});
if (!response.ok) {
throw new Error(`Failed to reach export-story API (status code ${response.status})`);
}
@ -129,7 +133,7 @@ async function exportStory(id: string, options: { outputDir: string }) {
.replace(/\?(&?[a-z][a-zA-Z0-9_-]+=[a-zA-Z0-9_-]*)*$/, "");
await copyFile(thumbnailPath, join(outputDir, `thumbnail${thumbnailPath.match(/\.[^.]+$/)![0]}`));
} else {
const thumbnail = await fetchRetry(data.thumbnail, { retries: 2, retryDelay: 10000 });
const thumbnail = await fetchRetry(data.thumbnail, { retries: 2, retryDelay: 2000 });
if (!thumbnail.ok) {
throw new Error("Failed to get thumbnail");
}