fix
This commit is contained in:
parent
15c0ef6977
commit
2d6d3fd7a9
|
|
@ -15,6 +15,8 @@ export const _ = {
|
|||
| { type: "check" }
|
||||
| { type: "db-update"; url: string }
|
||||
| { type: "db-pull" }
|
||||
| { type: "db-gen" }
|
||||
| { type: "db-sync"; url: string }
|
||||
| { type: "restart" }
|
||||
| { type: "domain-add"; domain: string }
|
||||
| { type: "domain-del"; domain: string }
|
||||
|
|
@ -43,6 +45,15 @@ export const _ = {
|
|||
url: g.dburl || "-",
|
||||
},
|
||||
};
|
||||
case "db-sync": {
|
||||
const res = await fetch(action.url);
|
||||
const text = await res.text();
|
||||
console.log(text);
|
||||
if (text) {
|
||||
await Bun.write(dir("app/db/prisma/schema.prisma"), text);
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
case "db-update":
|
||||
if (action.url) {
|
||||
g.dburl = action.url;
|
||||
|
|
@ -54,6 +65,16 @@ DATABASE_URL="${action.url}"
|
|||
);
|
||||
}
|
||||
return "ok";
|
||||
case "db-gen":
|
||||
{
|
||||
await $({ cwd: dir("app/db") })`bun prisma generate`;
|
||||
|
||||
res.send("ok");
|
||||
setTimeout(() => {
|
||||
restartServer();
|
||||
}, 300);
|
||||
}
|
||||
break;
|
||||
case "db-pull":
|
||||
{
|
||||
const env = await readAsync(dir("app/db/.env"));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import brotliPromise from "brotli-wasm"; // Import the default export
|
||||
import { gzipSync } from "bun";
|
||||
import { simpleHash } from "utils/cache";
|
||||
import { g } from "utils/global";
|
||||
const brotli = await brotliPromise;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ export const serveAPI = async (url: URL, req: Request) => {
|
|||
if (!req.headers.get("content-type")?.startsWith("multipart/form-data")) {
|
||||
try {
|
||||
const json = await req.json();
|
||||
|
||||
|
||||
if (typeof json === "object") {
|
||||
if (Array.isArray(json)) {
|
||||
args = json;
|
||||
|
|
@ -47,8 +45,9 @@ export const serveAPI = async (url: URL, req: Request) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) { }
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue