easy-devops 1.3.6 → 1.4.1

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.
Files changed (78) hide show
  1. package/README.md +1 -0
  2. package/dist/ui/assets/index-Bu7af-Kj.css +1 -0
  3. package/dist/ui/assets/index-gndgYe3K.js +532 -0
  4. package/dist/ui/assets/socket-Bv0wCEgi.js +65 -0
  5. package/dist/ui/index.html +2 -2
  6. package/install.bat +14 -7
  7. package/package.json +2 -2
  8. package/src/cli/index.js +8 -0
  9. package/src/cli/managers/domain-manager.js +37 -6
  10. package/src/cli/managers/nginx-manager.js +14 -5
  11. package/src/cli/managers/node-manager.js +19 -13
  12. package/src/cli/managers/ssl-manager.js +89 -26
  13. package/src/cli/menu.js +8 -2
  14. package/src/cli/menus/cleanup.js +4 -2
  15. package/src/cli/menus/dashboard.js +22 -15
  16. package/src/cli/menus/hub.js +402 -0
  17. package/src/cli/menus/runtime.js +12 -0
  18. package/src/cli/menus/service.js +80 -13
  19. package/src/cli/menus/settings.js +46 -12
  20. package/src/cli/menus/uninstall.js +13 -5
  21. package/src/cli/menus/update.js +24 -14
  22. package/src/cli/ui/page.js +123 -0
  23. package/src/core/cert-operations.js +34 -4
  24. package/src/core/cert-reader.js +67 -22
  25. package/src/core/cert-renewal.js +65 -9
  26. package/src/core/cert-suggest.js +120 -0
  27. package/src/core/cleanup.js +221 -1
  28. package/src/core/cloudflare-ips.js +161 -0
  29. package/src/core/daemon/ipc.js +1 -1
  30. package/src/core/daemon/lock.js +296 -9
  31. package/src/core/daemon/run.js +12 -0
  32. package/src/core/daemon/stateFile.js +128 -0
  33. package/src/core/dashboardProcess.js +134 -6
  34. package/src/core/db.js +26 -1
  35. package/src/core/deploy/apps.js +36 -62
  36. package/src/core/deploy/deployKey.js +331 -0
  37. package/src/core/deploy/domainLink.js +280 -23
  38. package/src/core/deploy/engine.js +382 -63
  39. package/src/core/deploy/ezfile.js +496 -29
  40. package/src/core/deploy/githubApi.js +100 -13
  41. package/src/core/deploy/hubCommands.js +158 -18
  42. package/src/core/deploy/status.js +28 -1
  43. package/src/core/domains-db.js +1 -0
  44. package/src/core/hub/agent.js +238 -32
  45. package/src/core/hub/deployProgress.js +411 -0
  46. package/src/core/hubConnect.js +205 -0
  47. package/src/core/hubPermissions.js +48 -10
  48. package/src/core/jobs/bus.js +1 -1
  49. package/src/core/jobs/owner.js +268 -6
  50. package/src/core/nginx-conf-generator.js +124 -19
  51. package/src/core/notifications/claim.js +26 -3
  52. package/src/core/permissions.js +277 -59
  53. package/src/core/platform.js +73 -2
  54. package/src/core/runner.js +96 -40
  55. package/src/core/service/dataDir.js +34 -9
  56. package/src/core/service/index.js +203 -24
  57. package/src/core/service/runtime.js +40 -3
  58. package/src/core/service/windowsService.js +452 -107
  59. package/src/core/service/winsw.js +44 -3
  60. package/src/core/ssl/preflight.js +548 -0
  61. package/src/core/ssl/progress.js +196 -0
  62. package/src/core/ssl-issuer.js +502 -148
  63. package/src/core/validators.js +24 -0
  64. package/src/dashboard/controllers/authController.js +12 -5
  65. package/src/dashboard/controllers/deploymentsController.js +76 -11
  66. package/src/dashboard/controllers/domainsController.js +35 -1
  67. package/src/dashboard/controllers/hubController.js +4 -3
  68. package/src/dashboard/controllers/settingsController.js +73 -68
  69. package/src/dashboard/controllers/sslController.js +135 -15
  70. package/src/dashboard/public/js/app.js +42 -7
  71. package/src/dashboard/routes/deployments.js +2 -0
  72. package/src/dashboard/routes/domains.js +1 -0
  73. package/src/dashboard/server.js +42 -7
  74. package/src/dashboard/socketManager.js +19 -25
  75. package/src/dashboard/views/partials/settings-panel.ejs +29 -10
  76. package/dist/ui/assets/index-BUpPxWmp.css +0 -1
  77. package/dist/ui/assets/index-DD0JjK0Q.js +0 -475
  78. package/dist/ui/assets/socket-4tfdap-e.js +0 -65
@@ -198,6 +198,31 @@ export function inspectLink(dataDir) {
198
198
  */
199
199
  const COPY_ENTRIES = ['package.json', 'src', 'node_modules', 'dist'];
200
200
 
201
+ /** Path equality as Windows sees it: case-insensitive, separators normalised. */
202
+ function samePath(a, b) {
203
+ return path.resolve(a).toLowerCase() === path.resolve(b).toLowerCase();
204
+ }
205
+
206
+ /**
207
+ * copyFileSync, retried briefly on EBUSY/EPERM.
208
+ *
209
+ * A service that has just reported STOPPED can hold node.exe for a moment
210
+ * longer while Windows tears the process down; a few hundred milliseconds of
211
+ * patience turns that race into a success. Anything still locked after the
212
+ * retries is a real lock, and the error says so.
213
+ */
214
+ function copyFileRetrying(from, to, { tries = 10, delayMs = 300 } = {}) {
215
+ for (let attempt = 1; ; attempt++) {
216
+ try {
217
+ fs.copyFileSync(from, to);
218
+ return;
219
+ } catch (err) {
220
+ if (attempt >= tries || !(err.code === 'EBUSY' || err.code === 'EPERM')) throw err;
221
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, delayMs);
222
+ }
223
+ }
224
+ }
225
+
201
226
  /**
202
227
  * Copies node.exe and the application into the runtime directory.
203
228
  *
@@ -224,10 +249,22 @@ export function copyRuntime({ dataDir, appRoot, nodeExe = process.execPath, log
224
249
  }
225
250
 
226
251
  try {
227
- fs.copyFileSync(fs.realpathSync(nodeExe), destNode);
228
- log(`Copied node.exe → ${destNode}`);
252
+ const source = fs.realpathSync(nodeExe);
253
+ // The updater refreshes the copy FROM the copy's own node.exe; copying a
254
+ // file onto itself is at best pointless and at worst a sharing violation.
255
+ if (fs.existsSync(destNode) && samePath(source, fs.realpathSync(destNode))) {
256
+ log(`node.exe is already the runtime copy (${destNode}); kept`);
257
+ } else {
258
+ copyFileRetrying(source, destNode);
259
+ log(`Copied node.exe → ${destNode}`);
260
+ }
229
261
  } catch (err) {
230
- return { ok: false, reason: `could not copy node.exe: ${err.message}` };
262
+ const locked = err.code === 'EBUSY' || err.code === 'EPERM';
263
+ return {
264
+ ok: false,
265
+ reason: `could not copy node.exe: ${err.message}`
266
+ + (locked ? '. Windows locks a running executable: stop the service first (ezz service stop).' : ''),
267
+ };
231
268
  }
232
269
 
233
270
  for (const entry of COPY_ENTRIES) {