bonzai-tools 1.0.97 → 1.0.98
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.
|
@@ -7,14 +7,40 @@ const fs = require('fs');
|
|
|
7
7
|
const path = require('path');
|
|
8
8
|
const { ROOT } = require('./config');
|
|
9
9
|
|
|
10
|
+
const port = 3001;
|
|
10
11
|
const app = express();
|
|
11
12
|
const server = http.createServer(app);
|
|
12
13
|
|
|
13
14
|
app.use(cors());
|
|
14
15
|
app.use(express.json());
|
|
15
16
|
|
|
16
|
-
//
|
|
17
|
+
// Embed shell - serves HTML that loads app from CDN
|
|
17
18
|
app.get('/', (req, res) => {
|
|
19
|
+
const repoName = path.basename(ROOT);
|
|
20
|
+
res.send(`<!DOCTYPE html>
|
|
21
|
+
<html>
|
|
22
|
+
<head>
|
|
23
|
+
<meta charset="UTF-8">
|
|
24
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
25
|
+
<title>Bonzai - ${repoName}</title>
|
|
26
|
+
<style>
|
|
27
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
28
|
+
html, body, #root { height: 100%; }
|
|
29
|
+
</style>
|
|
30
|
+
</head>
|
|
31
|
+
<body>
|
|
32
|
+
<div id="root"></div>
|
|
33
|
+
<script>
|
|
34
|
+
window.BONZAI_REPO = "${repoName}";
|
|
35
|
+
window.BONZAI_API = "http://localhost:${port}";
|
|
36
|
+
</script>
|
|
37
|
+
<script src="https://bonzai.dev/app.js"></script>
|
|
38
|
+
</body>
|
|
39
|
+
</html>`);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Health check
|
|
43
|
+
app.get('/health', (req, res) => {
|
|
18
44
|
const repoName = path.basename(ROOT);
|
|
19
45
|
res.json({ message: 'Bonzai Server', status: 'running', repoName });
|
|
20
46
|
});
|
|
@@ -53,7 +79,6 @@ if (terminalHandlers) {
|
|
|
53
79
|
app.get('/terminal', terminalHandlers.terminalHandler);
|
|
54
80
|
}
|
|
55
81
|
|
|
56
|
-
const port = 3001;
|
|
57
82
|
server.listen(port, () => {
|
|
58
83
|
console.log('File server running on http://localhost:' + port);
|
|
59
84
|
});
|