fix(wallpaper): proxy Bing images through Worker
This commit is contained in:
1 parent
bf30001c42
commit
765a7de7b5
9 files changed
+85
-10
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { mkdir, readFile, rm, writeFile, copyFile } from "node:fs/promises";
|
||||
|
||||
const text = (file) => readFile(new URL(`../public/${file}`, import.meta.url), "utf8");
|
||||
const dist = new URL("../dist/", import.meta.url);
|
||||
const server = new URL("../dist/server/", import.meta.url);
|
||||
const meta = new URL("../dist/.openai/", import.meta.url);
|
||||
|
||||
await rm(dist, { recursive: true, force: true });
|
||||
await Promise.all([mkdir(server, { recursive: true }), mkdir(meta, { recursive: true })]);
|
||||
const [indexHtml, addonsJs] = await Promise.all([text("index.html"), text("addons.js")]);
|
||||
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("../.openai/hosting.json", import.meta.url), new URL("hosting.json", meta));
|
||||
console.log("Built Life OS Worker artifact");
|
||||
@@ -0,0 +1,8 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
const worker = await import(new URL("../dist/server/index.js", import.meta.url));
|
||||
assert.equal(typeof worker.default?.fetch, "function");
|
||||
const html = await readFile(new URL("../dist/server/assets.js", import.meta.url), "utf8");
|
||||
assert.match(html, /indexHtml/);
|
||||
console.log("Life OS Worker artifact is valid");
|
||||
Reference in new issue
Block a user