This commit is contained in:
Rizky 2024-08-08 14:45:18 +07:00
parent d6644860ee
commit c33e081841
4 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import { $ } from "bun"; import { $ } from "bun";
import Database from "bun:sqlite"; import Database from "bun:sqlite";
import { copyAsync, removeAsync } from "fs-jetpack"; import { copyAsync } from "fs-jetpack";
import mime from "mime"; import mime from "mime";
import { deploy } from "utils/deploy"; import { deploy } from "utils/deploy";
import { dir } from "utils/dir"; import { dir } from "utils/dir";
@ -50,6 +50,7 @@ export const _ = {
content: g.deploy.content?.site?.config?.api_url || "", content: g.deploy.content?.site?.config?.api_url || "",
}); });
const gz = g.deploy.content; const gz = g.deploy.content;
if (gz) { if (gz) {
let layout = null as null | SinglePage; let layout = null as null | SinglePage;
for (const l of gz.layouts) { for (const l of gz.layouts) {
@ -80,7 +81,7 @@ export const _ = {
add({ add({
path: "load-js", path: "load-js",
type: "", type: "",
content: await getContent("load.js.prod", api_url), content: await getContent("load.js.prod", `"${api_url}"`),
}); });
} }

View File

@ -73,6 +73,7 @@ export const createResponse = (
if (opt?.cache_accept) { if (opt?.cache_accept) {
let cached = false; let cached = false;
if ( if (
opt?.high_compression && opt?.high_compression &&
opt.cache_accept.toLowerCase().includes("br") opt.cache_accept.toLowerCase().includes("br")

View File

@ -10,7 +10,7 @@ export const serveWeb = async (arg: {
return createResponse(arg.content, { return createResponse(arg.content, {
cache_accept: arg.cache_accept, cache_accept: arg.cache_accept,
high_compression: false, high_compression: true,
headers: !type ? undefined : { "content-type": type }, headers: !type ? undefined : { "content-type": type },
}); });
}; };

View File

@ -143,7 +143,7 @@ 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}] ${base_url}`
); );
const res = await fetch( const res = await fetch(
`${base_url}/prod-zip/${this.config.site_id}?ts=${Date.now()}&msgpack=1` `${base_url}/prod-zip/${this.config.site_id}?ts=${Date.now()}&msgpack=1`