@beastmode-develeap/beastmode 0.1.31 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +23 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6242,21 +6242,32 @@ async function startServer(options = {}) {
|
|
|
6242
6242
|
const initRoutes = getRoutes();
|
|
6243
6243
|
const boardRoutes = options.factoryPath ? getBoardRoutes(options.factoryPath) : [];
|
|
6244
6244
|
let staticDir;
|
|
6245
|
-
let indexHtml;
|
|
6246
|
-
let boardHtml;
|
|
6247
6245
|
try {
|
|
6248
6246
|
staticDir = resolveStaticDir();
|
|
6249
|
-
indexHtml = readFileSync13(join14(staticDir, "index.html"), "utf-8");
|
|
6250
6247
|
} catch {
|
|
6251
6248
|
staticDir = "";
|
|
6252
|
-
indexHtml = "<html><body><h1>BeastMode Init Wizard</h1><p>Static files not found.</p></body></html>";
|
|
6253
6249
|
}
|
|
6254
|
-
|
|
6255
|
-
const
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6250
|
+
function loadIndexHtml() {
|
|
6251
|
+
const fallback = "<html><body><h1>BeastMode Init Wizard</h1><p>Static files not found.</p></body></html>";
|
|
6252
|
+
if (!staticDir) return fallback;
|
|
6253
|
+
try {
|
|
6254
|
+
const indexPath = join14(staticDir, "index.html");
|
|
6255
|
+
if (!existsSync16(indexPath)) return fallback;
|
|
6256
|
+
return readFileSync13(indexPath, "utf-8");
|
|
6257
|
+
} catch {
|
|
6258
|
+
return fallback;
|
|
6259
|
+
}
|
|
6260
|
+
}
|
|
6261
|
+
function loadBoardHtml() {
|
|
6262
|
+
const fallback = "<html><body><h1>BeastMode Board</h1><p>board.html not found.</p></body></html>";
|
|
6263
|
+
try {
|
|
6264
|
+
const dir = staticDir || resolveStaticDir();
|
|
6265
|
+
const boardPath = join14(dir, "board.html");
|
|
6266
|
+
if (!existsSync16(boardPath)) return fallback;
|
|
6267
|
+
return readFileSync13(boardPath, "utf-8");
|
|
6268
|
+
} catch {
|
|
6269
|
+
return fallback;
|
|
6270
|
+
}
|
|
6260
6271
|
}
|
|
6261
6272
|
let chatManager = null;
|
|
6262
6273
|
if (options.factoryPath) {
|
|
@@ -6409,7 +6420,7 @@ async function startServer(options = {}) {
|
|
|
6409
6420
|
}
|
|
6410
6421
|
if (method === "GET") {
|
|
6411
6422
|
if (url === "/board" || url === "/board.html") {
|
|
6412
|
-
let html =
|
|
6423
|
+
let html = loadBoardHtml();
|
|
6413
6424
|
if (options.factoryPath || options.factoryName) {
|
|
6414
6425
|
const boardData = JSON.stringify({
|
|
6415
6426
|
factoryPath: options.factoryPath || "",
|
|
@@ -6429,7 +6440,7 @@ async function startServer(options = {}) {
|
|
|
6429
6440
|
res.end();
|
|
6430
6441
|
return;
|
|
6431
6442
|
}
|
|
6432
|
-
let html =
|
|
6443
|
+
let html = loadIndexHtml();
|
|
6433
6444
|
if (options.factoryName || options.projectPath) {
|
|
6434
6445
|
const initData = JSON.stringify({
|
|
6435
6446
|
factoryName: options.factoryName || "",
|