From a085e5b77d2a8c7f175c4c633caf6147e04ee5b5 Mon Sep 17 00:00:00 2001 From: Dan Fabulich Date: Tue, 21 Jan 2025 17:51:02 -0800 Subject: [PATCH 1/2] sitegen: Improve error handling --- src/iplayif.com/app/src/sitegen.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/iplayif.com/app/src/sitegen.ts b/src/iplayif.com/app/src/sitegen.ts index e91bf516..1d494491 100644 --- a/src/iplayif.com/app/src/sitegen.ts +++ b/src/iplayif.com/app/src/sitegen.ts @@ -87,7 +87,13 @@ export default class SiteGenerator { // Get all the files const files: Map = new Map() for (const file of paths) { - files.set(path.basename(file), await fetch(`https://${this.options.cdn_domain}/dist/web/${file}`).then(r => r.arrayBuffer()).then(b => new Uint8Array(b))) + const url = `https://${this.options.cdn_domain}/dist/web/${file}`; + const response = await fetch(url) + if (!response.ok) { + ctx.throw(500, `Failed ${response.status} downloading ${url}`) + } + const data = await response.arrayBuffer().then(b => new Uint8Array(b)) + files.set(path.basename(file), data) } const options: SingleFileOptions = { From 937bfb6c4c01b32b27a7faae90a5d141f55d34d2 Mon Sep 17 00:00:00 2001 From: Dan Fabulich Date: Tue, 21 Jan 2025 17:53:14 -0800 Subject: [PATCH 2/2] sitegen: Update required files Fixes #171 --- src/iplayif.com/app/src/sitegen.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/iplayif.com/app/src/sitegen.ts b/src/iplayif.com/app/src/sitegen.ts index 1d494491..47553b3b 100644 --- a/src/iplayif.com/app/src/sitegen.ts +++ b/src/iplayif.com/app/src/sitegen.ts @@ -22,10 +22,10 @@ import {get_metadata} from './metadata.js' const format_terp_files: Record = { adrift4: ['scare-core.wasm', 'scare.js'], - glulx: ['quixe.js'], + glulx: ['glulxe.wasm', 'glulxe.js'], hugo: ['hugo-core.wasm', 'hugo.js'], tads: ['tads-core.wasm', 'tads.js'], - zcode: ['zvm.js'], + zcode: ['bocfel.wasm', 'bocfel.js'], } export default class SiteGenerator { @@ -77,7 +77,7 @@ export default class SiteGenerator { const paths = [ '../../index.html', 'jquery.min.js', - 'main.js', + 'web.js', 'waiting.gif', 'web.css', '../fonts/iosevka/iosevka-extended.woff2', @@ -87,7 +87,7 @@ export default class SiteGenerator { // Get all the files const files: Map = new Map() for (const file of paths) { - const url = `https://${this.options.cdn_domain}/dist/web/${file}`; + const url = `https://${this.options.cdn_domain}/dist/web/${file}` const response = await fetch(url) if (!response.ok) { ctx.throw(500, `Failed ${response.status} downloading ${url}`)