This commit is contained in:
Rizky 2024-02-09 15:30:09 +07:00
parent eb3ab69d18
commit 27af6c01af
1 changed files with 50 additions and 53 deletions

View File

@ -1,8 +1,7 @@
import { existsAsync } from "fs-jetpack";
import { g } from "utils/global";
import { code } from "./util-code";
import type { Server, WebSocketHandler } from "bun";
import _fs from "node:fs/promises";
import { g } from "utils/global";
import { code } from "./util-code";
type PrasiServer = {
ws?: WebSocketHandler<{ url: string }>;
@ -14,7 +13,8 @@ type PrasiServer = {
}) => Promise<Response>;
};
const _server = {
if (!g._server) {
g._server = {
handler: {} as Record<string, PrasiServer>,
init_timeout: null as any,
init(site_id: string) {
@ -61,9 +61,6 @@ const _server = {
}
}
},
};
if (!g._server) {
g._server = _server;
};
}
export const server = g._server;