wip fix
This commit is contained in:
parent
02a2e0c121
commit
7e3134d5c0
|
|
@ -69,30 +69,42 @@ export const createServer = async () => {
|
||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g.deploy.gz && g.deploy.index) {
|
if (g.deploy.index) {
|
||||||
const core = g.deploy.gz.code.core;
|
if (g.deploy.router) {
|
||||||
const site = g.deploy.gz.code.site;
|
const found = g.deploy.router.lookup(url.pathname);
|
||||||
|
if (found) {
|
||||||
let pathname = url.pathname;
|
return await serveWeb({
|
||||||
if (url.pathname[0] === "/") pathname = pathname.substring(1);
|
content: g.deploy.index.render(),
|
||||||
|
pathname: "index.html",
|
||||||
if (
|
});
|
||||||
!pathname ||
|
}
|
||||||
pathname === "index.html" ||
|
|
||||||
pathname === "index.htm"
|
|
||||||
) {
|
|
||||||
return await serveWeb({
|
|
||||||
content: g.deploy.index.render(),
|
|
||||||
pathname: "index.html",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let content = "";
|
if (g.deploy.gz) {
|
||||||
if (core[pathname]) content = core[pathname];
|
const core = g.deploy.gz.code.core;
|
||||||
else if (site[pathname]) content = site[pathname];
|
const site = g.deploy.gz.code.site;
|
||||||
|
|
||||||
if (content) {
|
let pathname = url.pathname;
|
||||||
return await serveWeb({ content, pathname });
|
if (url.pathname[0] === "/") pathname = pathname.substring(1);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!pathname ||
|
||||||
|
pathname === "index.html" ||
|
||||||
|
pathname === "index.htm"
|
||||||
|
) {
|
||||||
|
return await serveWeb({
|
||||||
|
content: g.deploy.index.render(),
|
||||||
|
pathname: "index.html",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let content = "";
|
||||||
|
if (core[pathname]) content = core[pathname];
|
||||||
|
else if (site[pathname]) content = site[pathname];
|
||||||
|
|
||||||
|
if (content) {
|
||||||
|
return await serveWeb({ content, pathname });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,9 @@ export const deploy = {
|
||||||
console.log(
|
console.log(
|
||||||
`Downloading site deploy: ${this.config.site_id} [ts: ${this.config.deploy.ts}]`
|
`Downloading site deploy: ${this.config.site_id} [ts: ${this.config.deploy.ts}]`
|
||||||
);
|
);
|
||||||
const res = await fetch(`${base_url}/prod-zip/${this.config.site_id}`);
|
const res = await fetch(
|
||||||
|
`${base_url}/prod-zip/${this.config.site_id}?ts=${Date.now()}`
|
||||||
|
);
|
||||||
const ts = Date.now();
|
const ts = Date.now();
|
||||||
|
|
||||||
const file = Bun.file(dir(`app/web/deploy/${ts}.gz`));
|
const file = Bun.file(dir(`app/web/deploy/${ts}.gz`));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue