easy-devops 1.3.5 → 1.3.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-devops",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "A unified DevOps management tool with CLI and web dashboard for managing Nginx, SSL certificates, deployment apps, and Node.js on Linux and Windows servers.",
5
5
  "keywords": [
6
6
  "devops",
@@ -186,9 +186,39 @@ if (servingNewUi) {
186
186
  // handled by the static index. A real path (/domains/example.com) gets the
187
187
  // same index.html so the app can resolve it. Static files above win first,
188
188
  // and /api and /socket.io never reach this point with a routed request.
189
+ //
190
+ // `root` is load-bearing: with an absolute path, send() walks every segment
191
+ // of it as a potential dotfile and answers 404 for any that starts with a
192
+ // dot — a global Bun install lives under ~/.bun, so the built UI would
193
+ // never be served there. Root-relative parts contain no dot segments.
194
+ //
195
+ // A build that disappears after startup would otherwise reach Express's
196
+ // default error handler, which prints a stack trace in the browser. Fall
197
+ // back to the classic page instead, and report it once, not per request.
198
+ let indexErrorReported = false;
189
199
  app.use((req, res, next) => {
190
200
  if (req.method !== 'GET' && req.method !== 'HEAD') return next();
191
- res.sendFile(uiIndexFile, { headers: { 'Cache-Control': 'no-cache' } });
201
+ res.sendFile('index.html', {
202
+ root: uiDistDir,
203
+ headers: { 'Cache-Control': 'no-cache' },
204
+ }, (err) => {
205
+ if (!err) return;
206
+ // Client gone, or the body already started: nothing left to render.
207
+ if (res.headersSent || err.code === 'ECONNABORTED' || err.syscall === 'write') return;
208
+ if (!indexErrorReported) {
209
+ indexErrorReported = true;
210
+ process.stderr.write(
211
+ '\nThe dashboard UI could not be served:\n' +
212
+ ` ${uiIndexFile}\n` +
213
+ ` ${err.message}\n` +
214
+ ' Serving the classic dashboard until it can.\n\n'
215
+ );
216
+ }
217
+ res.render('index', (renderErr, html) => {
218
+ if (renderErr) return next(renderErr);
219
+ res.send(html);
220
+ });
221
+ });
192
222
  });
193
223
  } else {
194
224
  // Render EJS template for all other routes