easy-devops 1.2.1 → 1.3.0

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 (126) hide show
  1. package/README.md +97 -6
  2. package/dist/ui/assets/index-B6zdwEnG.css +1 -0
  3. package/dist/ui/assets/index-Cy0oNmul.js +442 -0
  4. package/dist/ui/assets/socket-DwLPrgsr.js +1 -0
  5. package/dist/ui/assets/socket-K5ttLD2q.js +65 -0
  6. package/dist/ui/brand/apple-touch-icon.png +0 -0
  7. package/dist/ui/brand/favicon-16.png +0 -0
  8. package/dist/ui/brand/favicon-32.png +0 -0
  9. package/dist/ui/brand/favicon-light-16.png +0 -0
  10. package/dist/ui/brand/favicon-light-32.png +0 -0
  11. package/dist/ui/brand/favicon.ico +0 -0
  12. package/dist/ui/brand/icon-192.png +0 -0
  13. package/dist/ui/brand/icon-48.png +0 -0
  14. package/dist/ui/brand/icon-512.png +0 -0
  15. package/dist/ui/brand/icon-64-light.png +0 -0
  16. package/dist/ui/brand/icon-64.png +0 -0
  17. package/dist/ui/brand/logo-dark.png +0 -0
  18. package/dist/ui/brand/logo-light.png +0 -0
  19. package/dist/ui/brand/mark-dark.png +0 -0
  20. package/dist/ui/brand/mark-light.png +0 -0
  21. package/dist/ui/index.html +71 -0
  22. package/install.ps1 +188 -1
  23. package/install.sh +254 -29
  24. package/package.json +15 -4
  25. package/src/cli/dash.js +110 -0
  26. package/src/cli/index.js +237 -106
  27. package/src/cli/managers/domain-manager.js +60 -40
  28. package/src/cli/managers/ssl-manager.js +47 -330
  29. package/src/cli/menu.js +156 -0
  30. package/src/cli/menus/cleanup.js +205 -0
  31. package/src/cli/menus/dashboard.js +92 -1
  32. package/src/cli/menus/runtime.js +236 -0
  33. package/src/cli/menus/service.js +764 -0
  34. package/src/cli/menus/settings.js +176 -8
  35. package/src/cli/menus/uninstall.js +167 -0
  36. package/src/cli/menus/update.js +221 -65
  37. package/src/core/acme-challenge.js +273 -0
  38. package/src/core/cert-operations.js +189 -0
  39. package/src/{dashboard/lib → core}/cert-reader.js +2 -2
  40. package/src/core/cert-renewal.js +494 -0
  41. package/src/core/cleanup.js +600 -0
  42. package/src/core/config.js +169 -2
  43. package/src/core/daemon/ipc.js +292 -0
  44. package/src/core/daemon/lock.js +294 -0
  45. package/src/core/daemon/run.js +241 -0
  46. package/src/core/daemon/stopRequest.js +162 -0
  47. package/src/core/db.js +37 -8
  48. package/src/core/deploy/apps.js +491 -0
  49. package/src/core/deploy/domainLink.js +200 -0
  50. package/src/core/deploy/engine.js +973 -0
  51. package/src/core/deploy/ezfile.js +361 -0
  52. package/src/core/deploy/github.js +239 -0
  53. package/src/core/deploy/githubApi.js +261 -0
  54. package/src/core/deploy/hookServer.js +325 -0
  55. package/src/core/deploy/hubCommands.js +267 -0
  56. package/src/core/deploy/launcher.js +57 -0
  57. package/src/core/deploy/status.js +91 -0
  58. package/src/core/deploy/store.js +398 -0
  59. package/src/core/domainNotifier.js +94 -28
  60. package/src/core/domains-db.js +234 -0
  61. package/src/core/events.js +94 -2
  62. package/src/core/hub/agent.js +842 -0
  63. package/src/core/hubLink.js +306 -0
  64. package/src/core/hubPermissions.js +430 -0
  65. package/src/core/installSource.js +162 -0
  66. package/src/core/jobs/bus.js +120 -0
  67. package/src/core/jobs/index.js +371 -0
  68. package/src/core/jobs/monitors.js +368 -0
  69. package/src/core/jobs/owner.js +217 -0
  70. package/src/core/jobs/revisionWatcher.js +106 -0
  71. package/src/core/nginx-apply.js +213 -0
  72. package/src/core/nginx-conf-generator.js +253 -17
  73. package/src/{dashboard/lib → core}/nginx-service.js +18 -9
  74. package/src/core/notifications/claim.js +214 -0
  75. package/src/core/notifications/dispatch.js +154 -0
  76. package/src/core/notifier.js +31 -1
  77. package/src/core/passwords.js +172 -0
  78. package/src/core/permissions.js +8 -4
  79. package/src/core/platform.js +709 -2
  80. package/src/core/probeCache.js +258 -0
  81. package/src/core/purge.js +372 -0
  82. package/src/core/runner.js +488 -0
  83. package/src/core/service/acl.js +226 -0
  84. package/src/core/service/dataDir.js +345 -0
  85. package/src/core/service/index.js +1128 -0
  86. package/src/core/service/legacy.js +218 -0
  87. package/src/core/service/runtime.js +446 -0
  88. package/src/core/service/runtimeUpdate.js +800 -0
  89. package/src/core/service/systemd.js +458 -0
  90. package/src/core/service/windowsPersonal.js +530 -0
  91. package/src/core/service/windowsService.js +576 -0
  92. package/src/core/service/winsw.js +260 -0
  93. package/src/core/setupCode.js +331 -0
  94. package/src/core/shell.js +70 -7
  95. package/src/core/ssl-issuer.js +627 -0
  96. package/src/core/updater.js +295 -0
  97. package/src/core/validators.js +99 -0
  98. package/src/dashboard/controllers/authController.js +302 -15
  99. package/src/dashboard/controllers/deploymentsController.js +479 -0
  100. package/src/dashboard/controllers/domainsController.js +39 -52
  101. package/src/dashboard/controllers/hubController.js +135 -0
  102. package/src/dashboard/controllers/nginxController.js +21 -3
  103. package/src/dashboard/controllers/processesController.js +368 -0
  104. package/src/dashboard/controllers/settingsController.js +180 -12
  105. package/src/dashboard/controllers/sslController.js +171 -10
  106. package/src/dashboard/lib/daemonBridge.js +163 -0
  107. package/src/dashboard/lib/localRequest.js +235 -0
  108. package/src/dashboard/lib/loginRateLimit.js +119 -0
  109. package/src/dashboard/lib/requireAuth.js +80 -0
  110. package/src/dashboard/public/js/app.js +489 -19
  111. package/src/dashboard/routes/auth.js +10 -10
  112. package/src/dashboard/routes/deployments.js +46 -0
  113. package/src/dashboard/routes/domains.js +9 -0
  114. package/src/dashboard/routes/hub.js +22 -0
  115. package/src/dashboard/routes/nginx.js +9 -0
  116. package/src/dashboard/routes/processes.js +29 -0
  117. package/src/dashboard/routes/settings.js +9 -0
  118. package/src/dashboard/routes/ssl.js +9 -0
  119. package/src/dashboard/server.js +288 -21
  120. package/src/dashboard/socketManager.js +171 -207
  121. package/src/dashboard/views/index.ejs +1 -0
  122. package/src/dashboard/views/partials/login.ejs +68 -7
  123. package/src/dashboard/views/partials/processes-panel.ejs +261 -0
  124. package/src/dashboard/views/partials/settings-panel.ejs +287 -0
  125. package/src/dashboard/views/partials/sidebar.ejs +2 -0
  126. package/src/dashboard/lib/domains-db.js +0 -51
@@ -0,0 +1,261 @@
1
+ <!-- Processes: the PM2 apps on this server, plus the Easy DevOps service -->
2
+ <div v-show="page === 'processes'" class="space-y-6">
3
+
4
+ <!-- ── Background service ───────────────────────────────────────────── -->
5
+ <div class="stat-card overflow-hidden relative">
6
+ <div class="absolute top-0 left-0 w-full h-1"
7
+ :class="svc.status && svc.status.running ? 'bg-green-500/40' : 'bg-yellow-500/40'"></div>
8
+
9
+ <div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5 flex items-start justify-between gap-4 flex-wrap">
10
+ <div>
11
+ <h3 class="form-label !mb-0 font-bold">Background service</h3>
12
+ <p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
13
+ Keeps the dashboard running and brings it back after a reboot
14
+ </p>
15
+ </div>
16
+ <button @click="loadProcessesPage" :disabled="svc.loading || processes.loading"
17
+ class="btn btn-secondary text-xs">
18
+ {{ (svc.loading || processes.loading) ? 'Refreshing…' : 'Refresh' }}
19
+ </button>
20
+ </div>
21
+
22
+ <div class="p-6 bg-background space-y-5">
23
+ <div v-if="svc.loading && !svc.status" class="text-sm text-muted">Checking…</div>
24
+
25
+ <template v-else-if="svc.status">
26
+ <!-- PM2 missing: the one thing that blocks everything else here -->
27
+ <div v-if="!svc.status.pm2.installed"
28
+ class="px-4 py-3 rounded-[10px] text-[13px] border bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-500">
29
+ PM2 is not installed on this server. Run
30
+ <code class="font-mono">ezz service install</code> in a terminal — it asks before
31
+ installing anything.
32
+ </div>
33
+
34
+ <template v-else>
35
+ <!-- Status grid -->
36
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
37
+ <div>
38
+ <p class="text-[10px] uppercase tracking-widest text-muted font-bold">Installed</p>
39
+ <p class="text-sm font-semibold mt-1"
40
+ :class="svc.status.installed ? 'text-green-500' : 'text-yellow-500'">
41
+ {{ svc.status.installed ? 'Yes' : 'No' }}
42
+ </p>
43
+ </div>
44
+ <div>
45
+ <p class="text-[10px] uppercase tracking-widest text-muted font-bold">Running</p>
46
+ <p class="text-sm font-semibold mt-1"
47
+ :class="svc.status.running ? 'text-green-500' : 'text-yellow-500'">
48
+ {{ svc.status.running ? 'Yes' : (svc.status.status || 'No') }}
49
+ </p>
50
+ </div>
51
+ <div>
52
+ <p class="text-[10px] uppercase tracking-widest text-muted font-bold">Start on boot</p>
53
+ <p class="text-sm font-semibold mt-1"
54
+ :class="svc.status.enabledOnBoot ? 'text-green-500' : 'text-yellow-500'">
55
+ {{ describeBoot(svc.status) }}
56
+ </p>
57
+ </div>
58
+ <div>
59
+ <p class="text-[10px] uppercase tracking-widest text-muted font-bold">PM2</p>
60
+ <p class="text-sm font-semibold mt-1 text-foreground">
61
+ {{ svc.status.pm2.version || 'installed' }}
62
+ </p>
63
+ </div>
64
+ </div>
65
+
66
+ <!-- App name and data directory, so a dev instance is obvious -->
67
+ <div class="flex flex-wrap gap-x-6 gap-y-2 text-[11px] text-muted">
68
+ <span>App <code class="font-mono text-foreground">{{ svc.status.appName }}</code></span>
69
+ <span v-if="svc.status.dev"
70
+ class="px-1.5 py-0.5 rounded bg-yellow-500/15 text-yellow-600 dark:text-yellow-500 font-bold uppercase tracking-wide">
71
+ dev data dir
72
+ </span>
73
+ <span>Data <code class="font-mono break-all">{{ svc.status.dataDir }}</code></span>
74
+ </div>
75
+
76
+ <!-- PM2 keeps one process list per OS user -->
77
+ <div v-if="!svc.status.sameUser"
78
+ class="px-4 py-3 rounded-[10px] text-[13px] border bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-500">
79
+ The service belongs to OS user <strong>{{ svc.status.appUser }}</strong>, but this
80
+ dashboard runs as <strong>{{ svc.status.currentUser }}</strong>. PM2 keeps a separate
81
+ process list per user, so it cannot be controlled from here.
82
+ </div>
83
+
84
+ <!-- Not installed, or not enabled on boot -->
85
+ <div v-if="!svc.status.installed || !svc.status.enabledOnBoot"
86
+ class="px-4 py-3 rounded-[10px] text-[13px] border bg-surface border-border/60 text-muted space-y-1">
87
+ <p v-if="!svc.status.installed">
88
+ Easy DevOps is not running as a service, so it stops when you close the terminal.
89
+ </p>
90
+ <p v-else>
91
+ The service will not start on boot, so it will not come back after a reboot.
92
+ </p>
93
+ <p class="text-foreground">
94
+ Run <code class="font-mono">{{ svc.status.cliHint }}</code>
95
+ </p>
96
+ <!--
97
+ Installing is CLI-only on Windows: the at-boot task needs
98
+ administrator rights AND an interactive console, because Windows
99
+ itself prompts for the account password. A dashboard request has
100
+ no terminal to prompt on.
101
+ -->
102
+ <p v-if="!svc.status.canInstallFromDashboard" class="text-[11px] opacity-80">
103
+ This cannot be done from the dashboard on Windows — the at-boot task needs an
104
+ elevated terminal, and Windows must ask you for the account password itself.
105
+ </p>
106
+ </div>
107
+
108
+ <!-- Restarting an installed service needs no elevation or prompt -->
109
+ <div v-if="svc.status.installed && svc.status.sameUser" class="flex items-center gap-3 flex-wrap">
110
+ <button @click="restartService" :disabled="svc.restarting" class="btn btn-secondary text-xs">
111
+ {{ svc.restarting ? 'Restarting…' : 'Restart service' }}
112
+ </button>
113
+ <span class="text-[11px] text-muted">
114
+ The dashboard will be briefly unavailable while it restarts.
115
+ </span>
116
+ </div>
117
+
118
+ <div v-if="svc.message"
119
+ class="px-4 py-3 rounded-[10px] text-[13px] border"
120
+ :class="svc.error ? 'bg-red-500/10 border-red-500/20 text-red-500'
121
+ : 'bg-green-500/10 border-green-500/20 text-green-600 dark:text-green-500'">
122
+ {{ svc.message }}
123
+ </div>
124
+ </template>
125
+ </template>
126
+ </div>
127
+ </div>
128
+
129
+ <!-- ── PM2 processes ────────────────────────────────────────────────── -->
130
+ <div class="stat-card overflow-hidden">
131
+ <div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5">
132
+ <h3 class="form-label !mb-0 font-bold">
133
+ PM2 processes
134
+ <span v-if="processes.apps.length" class="text-xs text-muted font-normal ml-1">
135
+ {{ processes.apps.length }} total
136
+ </span>
137
+ </h3>
138
+ <p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
139
+ Everything PM2 is supervising for this user
140
+ </p>
141
+ </div>
142
+
143
+ <div class="bg-background">
144
+ <div v-if="processes.loading && !processes.apps.length" class="p-8 text-sm text-muted">Loading…</div>
145
+
146
+ <div v-else-if="!processes.pm2Installed" class="p-8 text-center">
147
+ <p class="text-sm text-muted">PM2 is not installed.</p>
148
+ </div>
149
+
150
+ <div v-else-if="!processes.apps.length" class="p-8 text-center">
151
+ <p class="text-sm text-muted">PM2 is not supervising anything yet.</p>
152
+ </div>
153
+
154
+ <!-- Tables may scroll sideways; the page body must not -->
155
+ <div v-else class="overflow-x-auto">
156
+ <table class="w-full min-w-[46rem] text-left text-sm">
157
+ <thead>
158
+ <tr class="border-b border-border text-[10px] uppercase tracking-widest text-muted">
159
+ <th scope="col" class="px-5 py-3 font-bold">Name</th>
160
+ <th scope="col" class="px-5 py-3 font-bold">Status</th>
161
+ <th scope="col" class="px-5 py-3 font-bold tabular-nums">CPU</th>
162
+ <th scope="col" class="px-5 py-3 font-bold tabular-nums">Memory</th>
163
+ <th scope="col" class="px-5 py-3 font-bold tabular-nums">Uptime</th>
164
+ <th scope="col" class="px-5 py-3 font-bold tabular-nums">Restarts</th>
165
+ <th scope="col" class="px-5 py-3 font-bold text-right">Actions</th>
166
+ </tr>
167
+ </thead>
168
+ <tbody>
169
+ <tr v-for="app in processes.apps" :key="app.name + '-' + app.pmId"
170
+ class="border-b border-border/50 last:border-0">
171
+ <td class="px-5 py-3">
172
+ <span class="font-semibold text-foreground">{{ app.name }}</span>
173
+ <!--
174
+ Apps Easy DevOps created are labelled. Everything else is
175
+ listed but only ever acted on by an explicit click, and asks
176
+ for confirmation first.
177
+ -->
178
+ <span v-if="app.managed"
179
+ class="ml-2 px-1.5 py-0.5 rounded bg-primary/10 text-primary text-[10px] font-bold uppercase tracking-wide">
180
+ Easy DevOps
181
+ </span>
182
+ <span v-if="app.user && app.user !== processes.currentUser"
183
+ class="ml-2 px-1.5 py-0.5 rounded bg-yellow-500/15 text-yellow-600 dark:text-yellow-500 text-[10px] font-bold uppercase tracking-wide">
184
+ {{ app.user }}
185
+ </span>
186
+ </td>
187
+ <td class="px-5 py-3">
188
+ <span :class="app.status === 'online' ? 'text-green-500' : 'text-muted'">
189
+ {{ app.status }}
190
+ </span>
191
+ </td>
192
+ <td class="px-5 py-3 tabular-nums text-muted">{{ app.cpu === null ? '—' : app.cpu + '%' }}</td>
193
+ <td class="px-5 py-3 tabular-nums text-muted">{{ formatBytes(app.memoryBytes) }}</td>
194
+ <td class="px-5 py-3 tabular-nums text-muted">{{ formatDuration(app.uptimeMs) }}</td>
195
+ <td class="px-5 py-3 tabular-nums text-muted">{{ app.restarts }}</td>
196
+ <td class="px-5 py-3">
197
+ <div class="flex items-center justify-end gap-1.5 flex-wrap">
198
+ <button v-if="app.status !== 'online'" @click="processAction(app, 'start')"
199
+ :disabled="processes.busy === app.name" class="btn btn-secondary !px-2 !py-1 text-[11px]">
200
+ Start
201
+ </button>
202
+ <button v-else @click="processAction(app, 'stop')"
203
+ :disabled="processes.busy === app.name" class="btn btn-secondary !px-2 !py-1 text-[11px]">
204
+ Stop
205
+ </button>
206
+ <button @click="processAction(app, 'restart')"
207
+ :disabled="processes.busy === app.name" class="btn btn-secondary !px-2 !py-1 text-[11px]">
208
+ Restart
209
+ </button>
210
+ <button @click="showProcessLogs(app)"
211
+ :disabled="processes.busy === app.name" class="btn btn-secondary !px-2 !py-1 text-[11px]">
212
+ Logs
213
+ </button>
214
+ </div>
215
+ </td>
216
+ </tr>
217
+ </tbody>
218
+ </table>
219
+ </div>
220
+
221
+ <div v-if="processes.message" class="px-5 py-3 border-t border-border/50 text-[13px]"
222
+ :class="processes.error ? 'text-red-500' : 'text-green-600 dark:text-green-500'">
223
+ {{ processes.message }}
224
+ </div>
225
+ </div>
226
+ </div>
227
+
228
+ <!-- ── Logs for one process ─────────────────────────────────────────── -->
229
+ <div v-if="processes.logsFor" class="stat-card overflow-hidden">
230
+ <div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5 flex items-center justify-between gap-4">
231
+ <h3 class="form-label !mb-0 font-bold">Logs — {{ processes.logsFor }}</h3>
232
+ <button @click="processes.logsFor = null; processes.logLines = []"
233
+ class="btn btn-secondary text-xs">Close</button>
234
+ </div>
235
+ <pre class="bg-background p-5 text-[12px] font-mono text-muted overflow-x-auto max-h-96 overflow-y-auto whitespace-pre-wrap">{{ processes.logLines.join('\n') || '(no output)' }}</pre>
236
+ </div>
237
+
238
+ <!-- ── Confirm acting on a process ez did not create ─────────────────── -->
239
+ <div v-if="processes.confirm"
240
+ class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50"
241
+ @click.self="processes.confirm = null">
242
+ <div class="stat-card max-w-md w-full overflow-hidden">
243
+ <div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5">
244
+ <h3 class="form-label !mb-0 font-bold">Not an Easy DevOps process</h3>
245
+ </div>
246
+ <div class="p-6 bg-background space-y-4">
247
+ <p class="text-sm text-muted">
248
+ <code class="font-mono text-foreground">{{ processes.confirm.name }}</code> was not created
249
+ by Easy DevOps. {{ processes.confirm.action === 'stop' ? 'Stopping' : 'Restarting' }} it
250
+ affects whatever else relies on it.
251
+ </p>
252
+ <div class="flex gap-3 justify-end">
253
+ <button @click="processes.confirm = null" class="btn btn-secondary text-xs">Cancel</button>
254
+ <button @click="runConfirmedProcessAction" class="btn btn-primary text-xs">
255
+ {{ processes.confirm.action }} anyway
256
+ </button>
257
+ </div>
258
+ </div>
259
+ </div>
260
+ </div>
261
+ </div>
@@ -25,11 +25,87 @@
25
25
  : 'text-muted hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5'">
26
26
  🔔 Notifications
27
27
  </button>
28
+ <button
29
+ @click="settingsTab = 'hub'"
30
+ class="flex-1 px-4 py-2.5 text-sm font-semibold rounded-[8px] transition-all"
31
+ :class="settingsTab === 'hub'
32
+ ? 'bg-primary text-white shadow-sm'
33
+ : 'text-muted hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5'">
34
+ 🌐 Hub
35
+ </button>
28
36
  </div>
29
37
 
30
38
  <!-- Tab Content: General Settings -->
31
39
  <div v-show="settingsTab === 'general'" class="space-y-6">
32
40
 
41
+ <!--
42
+ Background service summary. Installing is done from the CLI (on
43
+ Windows the at-boot task needs an elevated, interactive terminal so
44
+ Windows can prompt for the account password), so this is a read-only
45
+ summary that points at the Processes page for the details.
46
+ -->
47
+ <div class="stat-card overflow-hidden relative">
48
+ <div class="absolute top-0 left-0 w-full h-1"
49
+ :class="svc.status && svc.status.running ? 'bg-green-500/40' : 'bg-yellow-500/40'"></div>
50
+ <div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5">
51
+ <h3 class="form-label !mb-0 font-bold">Background service</h3>
52
+ <p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
53
+ Whether Easy DevOps keeps running after you close the terminal
54
+ </p>
55
+ </div>
56
+ <div class="p-6 bg-background">
57
+ <div v-if="svc.loading && !svc.status" class="text-sm text-muted">Checking…</div>
58
+
59
+ <div v-else-if="svc.status && !svc.status.pm2.installed" class="space-y-2">
60
+ <p class="text-sm text-muted">Not set up — PM2 is not installed.</p>
61
+ <p class="text-[13px] text-foreground">
62
+ Run <code class="font-mono">{{ svc.status.cliHint }}</code>
63
+ </p>
64
+ </div>
65
+
66
+ <div v-else-if="svc.status" class="space-y-4">
67
+ <div class="grid grid-cols-3 gap-4">
68
+ <div>
69
+ <p class="text-[10px] uppercase tracking-widest text-muted font-bold">Installed</p>
70
+ <p class="text-sm font-semibold mt-1"
71
+ :class="svc.status.installed ? 'text-green-500' : 'text-yellow-500'">
72
+ {{ svc.status.installed ? 'Yes' : 'No' }}
73
+ </p>
74
+ </div>
75
+ <div>
76
+ <p class="text-[10px] uppercase tracking-widest text-muted font-bold">Running</p>
77
+ <p class="text-sm font-semibold mt-1"
78
+ :class="svc.status.running ? 'text-green-500' : 'text-yellow-500'">
79
+ {{ svc.status.running ? 'Yes' : (svc.status.status || 'No') }}
80
+ </p>
81
+ </div>
82
+ <div>
83
+ <p class="text-[10px] uppercase tracking-widest text-muted font-bold">On boot</p>
84
+ <p class="text-sm font-semibold mt-1"
85
+ :class="svc.status.enabledOnBoot ? 'text-green-500' : 'text-yellow-500'">
86
+ {{ describeBoot(svc.status) }}
87
+ </p>
88
+ </div>
89
+ </div>
90
+
91
+ <div v-if="!svc.status.installed || !svc.status.enabledOnBoot"
92
+ class="px-4 py-3 rounded-[10px] text-[13px] border bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-500">
93
+ <span v-if="!svc.status.installed">
94
+ Easy DevOps stops when this terminal closes and will not return after a reboot.
95
+ </span>
96
+ <span v-else>
97
+ The service will not start on boot, so it will not return after a reboot.
98
+ </span>
99
+ Run <code class="font-mono">{{ svc.status.cliHint }}</code>
100
+ </div>
101
+
102
+ <button @click="loadPage('processes')" class="btn btn-secondary text-xs">
103
+ Open Processes
104
+ </button>
105
+ </div>
106
+ </div>
107
+ </div>
108
+
33
109
  <!-- Application Configuration Card -->
34
110
  <div class="stat-card overflow-hidden relative">
35
111
  <div class="absolute top-0 left-0 w-full h-1 bg-primary/40"></div>
@@ -46,6 +122,71 @@
46
122
  <p class="text-[11px] text-muted mt-2 font-bold tracking-wide uppercase opacity-70">Restart dashboard after changing</p>
47
123
  </div>
48
124
 
125
+ <!--
126
+ How the dashboard authenticates.
127
+
128
+ "No password" is a real option for a single-user machine, not a
129
+ loophole: the server refuses it unless the listener is bound to
130
+ this machine only, and refuses to open the listener up again
131
+ while it is in force. Both halves are re-checked server-side —
132
+ this control only reflects what is permitted.
133
+ -->
134
+ <div class="w-full">
135
+ <label class="form-label">Authentication</label>
136
+ <select v-model="settings.dashboardAuth" class="form-input">
137
+ <option value="password">Password required</option>
138
+ <option value="none" :disabled="!settings.canUseNoPassword && settings.dashboardAuth !== 'none'">
139
+ No password (this machine only)
140
+ </option>
141
+ </select>
142
+
143
+ <p v-if="settings.dashboardAuth === 'none'"
144
+ class="text-[11px] mt-2 font-bold tracking-wide uppercase opacity-70 text-yellow-600 dark:text-yellow-500">
145
+ No login — reachable from this machine only
146
+ </p>
147
+ <p v-else-if="!settings.hasPassword"
148
+ class="text-[11px] mt-2 font-bold tracking-wide uppercase opacity-70 text-yellow-600 dark:text-yellow-500">
149
+ No password set yet — set one below
150
+ </p>
151
+ <p v-else class="text-[11px] text-muted mt-2 font-bold tracking-wide uppercase opacity-70">
152
+ A password is required to sign in
153
+ </p>
154
+
155
+ <p v-if="!settings.canUseNoPassword && settings.dashboardAuth !== 'none'"
156
+ class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
157
+ To remove the password, set Listen On to this machine only
158
+ </p>
159
+ </div>
160
+
161
+ <!--
162
+ Who can reach the dashboard. Loopback-only is the safer default
163
+ and the one new Linux installs get; an existing install keeps
164
+ listening everywhere until it is changed here.
165
+ -->
166
+ <div class="w-full">
167
+ <label class="form-label">Listen On</label>
168
+ <select v-model="settings.dashboardBindAddress" class="form-input">
169
+ <option value="127.0.0.1">This machine only (127.0.0.1)</option>
170
+ <option value="0.0.0.0">All interfaces (0.0.0.0)</option>
171
+ </select>
172
+ <p class="text-[11px] mt-2 font-bold tracking-wide uppercase opacity-70"
173
+ :class="settings.bindsToLoopbackOnly ? 'text-muted' : 'text-yellow-600 dark:text-yellow-500'">
174
+ <span v-if="settings.bindsToLoopbackOnly">
175
+ Currently {{ settings.dashboardBindAddress }} — reachable only from this machine
176
+ </span>
177
+ <span v-else>
178
+ Currently {{ settings.dashboardBindAddress }} — reachable from the network
179
+ </span>
180
+ </p>
181
+ <p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
182
+ Restart dashboard after changing
183
+ </p>
184
+ <p v-if="settings.dashboardAuth === 'none'"
185
+ class="text-[11px] mt-1 font-bold tracking-wide uppercase opacity-70 text-yellow-600 dark:text-yellow-500">
186
+ Locked to this machine while there is no password
187
+ </p>
188
+ </div>
189
+
49
190
  <div class="w-full">
50
191
  <label class="form-label">ACME Email (Let's Encrypt)</label>
51
192
  <input v-model="settings.acmeEmail" type="email" class="form-input" placeholder="admin@example.com" />
@@ -205,6 +346,152 @@
205
346
  </div>
206
347
  </div>
207
348
 
349
+ <!-- Tab Content: Hub -->
350
+ <div v-show="settingsTab === 'hub'" class="space-y-6">
351
+
352
+ <!-- Hub Connection card -->
353
+ <div class="stat-card overflow-hidden relative">
354
+ <div class="absolute top-0 left-0 w-full h-1" :class="hub.status.status === 'connected' ? 'bg-green-500/40' : (hub.status.status === 'rejected' ? 'bg-red-500/40' : 'bg-yellow-500/40')"></div>
355
+ <div class="p-6 border-b border-border/50 bg-black/5 dark:bg-white/5">
356
+ <h3 class="form-label !mb-0 font-bold">Easy DevOps Hub</h3>
357
+ <p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">Monitor and control this server from a central dashboard</p>
358
+ </div>
359
+
360
+ <!--
361
+ Which database this dashboard is using. `--dev` and
362
+ EASY_DEVOPS_DATA_DIR point at a different file, so a CLI started
363
+ without the same flag edits a different domain list entirely.
364
+ That looks exactly like a broken sync, so show it here.
365
+ -->
366
+ <div v-if="hub.status.dataDir" class="px-6 py-3 border-b border-border/50 flex items-start gap-2 flex-wrap text-[11px]">
367
+ <span class="font-bold uppercase tracking-wide text-muted opacity-70">Data directory</span>
368
+ <code class="font-mono text-[11px] text-foreground break-all">{{ hub.status.dataDir }}</code>
369
+ <span v-if="hub.status.devDataDir"
370
+ class="px-1.5 py-0.5 rounded bg-yellow-500/15 text-yellow-600 dark:text-yellow-500 font-bold uppercase tracking-wide">
371
+ dev override
372
+ </span>
373
+ <span v-if="hub.status.devDataDir" class="w-full text-muted">
374
+ This is not the normal data directory. The CLI must run with the same override, or it will
375
+ read and write a different domain list.
376
+ </span>
377
+ </div>
378
+
379
+ <!-- Not linked state — paste the string the hub issued -->
380
+ <div v-if="!hub.status.linked" class="p-8 space-y-6 bg-background">
381
+ <div class="space-y-2">
382
+ <p class="text-sm text-muted">Add this server in the Hub first, then paste the connection string it gives you.</p>
383
+ <ol class="text-[13px] text-muted list-decimal list-inside space-y-1">
384
+ <li>Open your Hub dashboard → <span class="font-semibold text-foreground">Add Server</span></li>
385
+ <li>Enter a display name and submit</li>
386
+ <li>Copy the connection string the Hub shows you</li>
387
+ <li>Paste it below and click Connect</li>
388
+ </ol>
389
+ </div>
390
+ <div class="w-full max-w-md space-y-4">
391
+ <div>
392
+ <label class="form-label">Connection String</label>
393
+ <textarea v-model.trim="hub.form.connectionString" class="form-input font-mono text-xs h-20 resize-none"
394
+ placeholder="ezops://https://hub.example.com|server-id|secret"></textarea>
395
+ <p class="text-[11px] text-muted mt-1 font-bold tracking-wide uppercase opacity-70">
396
+ Shown only once by the Hub. Treat it like a password.
397
+ </p>
398
+ </div>
399
+ <button @click="connectHubAgent" :disabled="hub.loading || !hub.form.connectionString" class="btn btn-primary min-w-[140px]">
400
+ <svg v-if="hub.loading" class="w-4 h-4 animate-spin -ml-1 mr-2 inline-block" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>
401
+ {{ hub.loading ? 'Connecting...' : 'Connect' }}
402
+ </button>
403
+ </div>
404
+ </div>
405
+
406
+ <!-- Linked state -->
407
+ <div v-else class="p-8 space-y-6 bg-background">
408
+ <div class="flex items-center gap-3 flex-wrap">
409
+ <span :class="hubStatusDotClass()" class="w-2.5 h-2.5 rounded-full"></span>
410
+ <span class="text-sm font-semibold">{{ hubStatusLabel() }}</span>
411
+ <span class="text-xs text-muted">{{ hub.status.hubUrl }}</span>
412
+ </div>
413
+
414
+ <!-- Why we are not connected -->
415
+ <div v-if="hub.status.lastError" class="px-4 py-3 rounded-[10px] text-[13px] border"
416
+ :class="hub.status.status === 'rejected'
417
+ ? 'bg-red-500/10 border-red-500/20 text-red-500'
418
+ : 'bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-500'">
419
+ {{ hub.status.lastError }}
420
+ </div>
421
+
422
+ <!-- Rejected: only a new string can fix this, so offer the input here -->
423
+ <div v-if="hub.status.status === 'rejected'" class="w-full max-w-md space-y-3 pt-2 border-t border-border/50">
424
+ <label class="form-label">Paste a new connection string</label>
425
+ <textarea v-model.trim="hub.form.connectionString" class="form-input font-mono text-xs h-20 resize-none"
426
+ placeholder="ezops://https://hub.example.com|server-id|secret"></textarea>
427
+ <button @click="connectHubAgent" :disabled="hub.loading || !hub.form.connectionString" class="btn btn-primary">
428
+ {{ hub.loading ? 'Connecting...' : 'Reconnect' }}
429
+ </button>
430
+ </div>
431
+
432
+ <div class="space-y-3">
433
+ <div>
434
+ <p class="text-xs font-bold uppercase tracking-wide text-muted">Allow Hub To</p>
435
+ <p class="text-[11px] text-muted mt-1 opacity-70">
436
+ Monitoring (metrics, nginx status, domains, certificate expiry) is always on and is not listed here.
437
+ These toggles are enforced on this server — the Hub cannot grant itself anything.
438
+ </p>
439
+ </div>
440
+
441
+ <div v-for="group in hub.status.tree" :key="group.id" class="border border-border/50 rounded-[10px] overflow-hidden">
442
+ <!-- Group header: checked / unchecked / indeterminate -->
443
+ <label class="flex items-start gap-3 p-3 cursor-pointer bg-black/5 dark:bg-white/5 hover:bg-black/10 dark:hover:bg-white/10 transition-colors">
444
+ <input type="checkbox" class="w-4 h-4 mt-0.5 shrink-0"
445
+ :checked="hubGroupChecked(group)"
446
+ :indeterminate.prop="hubGroupIndeterminate(group)"
447
+ @change="toggleHubGroup(group)" />
448
+ <span class="min-w-0">
449
+ <span class="text-sm font-semibold block">{{ group.label }}</span>
450
+ <span class="text-[11px] text-muted block mt-0.5">{{ group.description }}</span>
451
+ </span>
452
+ </label>
453
+
454
+ <!-- Children -->
455
+ <div class="divide-y divide-border/30">
456
+ <label v-for="child in group.children" :key="child.id"
457
+ class="flex items-start gap-3 py-2.5 pl-10 pr-3"
458
+ :class="child.comingSoon ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-black/5 dark:hover:bg-white/5'">
459
+ <input type="checkbox" class="w-3.5 h-3.5 mt-0.5 shrink-0"
460
+ :checked="hub.status.permissions[child.id] === true"
461
+ :disabled="child.comingSoon"
462
+ @change="toggleHubPermission(child)" />
463
+ <span class="min-w-0">
464
+ <span class="text-[13px] font-medium">
465
+ {{ child.label }}
466
+ <span v-if="child.comingSoon"
467
+ class="ml-2 text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-yellow-500/15 text-yellow-600 dark:text-yellow-500 border border-yellow-500/25">
468
+ Coming soon
469
+ </span>
470
+ </span>
471
+ <span class="text-[11px] text-muted block mt-0.5">{{ child.description }}</span>
472
+ </span>
473
+ </label>
474
+ </div>
475
+ </div>
476
+
477
+ <p class="text-[11px] text-muted opacity-70">{{ hubGrantedCount() }} permission(s) granted.</p>
478
+ </div>
479
+
480
+ <button @click="unlinkHub" :disabled="hub.loading" class="btn btn-secondary text-red-500 border-red-500/30 hover:bg-red-500/10">
481
+ Unlink from Hub
482
+ </button>
483
+ </div>
484
+
485
+ <!-- Messages -->
486
+ <div v-if="hub.msg" class="px-8 pb-6">
487
+ <span class="text-green-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-green-500/10 border border-green-500/20">{{ hub.msg }}</span>
488
+ </div>
489
+ <div v-if="hub.error" class="px-8 pb-6">
490
+ <span class="text-red-500 text-[13px] font-bold px-3 py-1.5 rounded-[10px] bg-red-500/10 border border-red-500/20">{{ hub.error }}</span>
491
+ </div>
492
+ </div>
493
+ </div>
494
+
208
495
  <!-- Channel Add/Edit Modal -->
209
496
  <div v-if="channelModal.open" class="fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 modal-overlay">
210
497
  <div class="relative w-full max-w-lg flex flex-col modal-card">
@@ -39,6 +39,8 @@
39
39
  <svg v-if="item.id === 'ssl'" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg>
40
40
  <!-- Domains -->
41
41
  <svg v-if="item.id === 'domains'" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"></path></svg>
42
+ <!-- Processes -->
43
+ <svg v-if="item.id === 'processes'" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path></svg>
42
44
  <!-- Logs -->
43
45
  <svg v-if="item.id === 'logs'" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
44
46
  <!-- Settings -->
@@ -1,51 +0,0 @@
1
- import { dbGet, dbSet } from '../../core/db.js';
2
- import { DOMAIN_DEFAULTS, migrateDomain } from '../../core/nginx-conf-generator.js';
3
-
4
- // Re-export DOMAIN_DEFAULTS for consumers
5
- export { DOMAIN_DEFAULTS, migrateDomain };
6
-
7
- /**
8
- * Get all domains, applying v2 migration to each record.
9
- * @returns {Array} Array of domain objects (v2 schema)
10
- */
11
- export function getDomains() {
12
- const raw = dbGet('domains') ?? [];
13
- return raw.map(migrateDomain);
14
- }
15
-
16
- /**
17
- * Save domains array to storage.
18
- * @param {Array} arr - Array of domain objects
19
- */
20
- export function saveDomains(arr) {
21
- dbSet('domains', arr);
22
- }
23
-
24
- /**
25
- * Find a domain by name.
26
- * @param {string} name - Domain name to find
27
- * @returns {Object|undefined} Domain object or undefined
28
- */
29
- export function findDomain(name) {
30
- return getDomains().find((d) => d.name === name);
31
- }
32
-
33
- /**
34
- * Create a new domain object with defaults merged.
35
- * @param {Object} partial - Partial domain data
36
- * @returns {Object} Complete domain object with defaults
37
- */
38
- export function createDomain(partial) {
39
- const now = new Date().toISOString();
40
- return {
41
- ...DOMAIN_DEFAULTS,
42
- ...partial,
43
- ssl: { ...DOMAIN_DEFAULTS.ssl, ...partial.ssl },
44
- performance: { ...DOMAIN_DEFAULTS.performance, ...partial.performance },
45
- security: { ...DOMAIN_DEFAULTS.security, ...partial.security },
46
- advanced: { ...DOMAIN_DEFAULTS.advanced, ...partial.advanced },
47
- configFile: null,
48
- createdAt: now,
49
- updatedAt: now,
50
- };
51
- }