fix(release): bust cached application assets

This commit is contained in:
Codex committed 2026-09-25 22:04:51 +09:00
1 parent 8c8eb73b74
commit a49092cf16
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -7,7 +7,9 @@ const meta = new URL("../dist/.openai/", import.meta.url);
await rm(dist, { recursive: true, force: true }); await rm(dist, { recursive: true, force: true });
await Promise.all([mkdir(server, { recursive: true }), mkdir(meta, { recursive: true })]); await Promise.all([mkdir(server, { recursive: true }), mkdir(meta, { recursive: true })]);
const [indexHtml, addonsJs] = await Promise.all([text("index.html"), text("addons.js")]); const [rawIndexHtml, addonsJs] = await Promise.all([text("index.html"), text("addons.js")]);
const release = "1.0.0";
const indexHtml = rawIndexHtml.replace('src="addons.js"', `src="addons.js?v=${release}"`);
await writeFile(new URL("assets.js", server), `export const indexHtml=${JSON.stringify(indexHtml)};\nexport const addonsJs=${JSON.stringify(addonsJs)};\n`); await writeFile(new URL("assets.js", server), `export const indexHtml=${JSON.stringify(indexHtml)};\nexport const addonsJs=${JSON.stringify(addonsJs)};\n`);
await copyFile(new URL("../worker/index.js", import.meta.url), new URL("index.js", server)); await copyFile(new URL("../worker/index.js", import.meta.url), new URL("index.js", server));
await copyFile(new URL("../.openai/hosting.json", import.meta.url), new URL("hosting.json", meta)); await copyFile(new URL("../.openai/hosting.json", import.meta.url), new URL("hosting.json", meta));
+1 -1
View File
@@ -33,7 +33,7 @@ export default {
} catch (error) { } catch (error) {
return Response.json({ error: "Bing wallpaper is temporarily unavailable", detail: String(error) }, { status: 502 }); return Response.json({ error: "Bing wallpaper is temporarily unavailable", detail: String(error) }, { status: 502 });
} }
if (url.pathname === "/addons.js") return new Response(addonsJs, { headers: headers("application/javascript; charset=utf-8") }); if (url.pathname === "/addons.js") return new Response(addonsJs, { headers: headers("application/javascript; charset=utf-8", "no-cache") });
if (url.pathname === "/" || url.pathname === "/index.html") return new Response(indexHtml, { headers: headers("text/html; charset=utf-8", "no-cache") }); if (url.pathname === "/" || url.pathname === "/index.html") return new Response(indexHtml, { headers: headers("text/html; charset=utf-8", "no-cache") });
return new Response("Not found", { status: 404 }); return new Response("Not found", { status: 404 });
}, },