plum-e2e 2.6.3 → 2.6.5
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.
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
const fs = require('fs');
|
|
30
|
+
const os = require('os');
|
|
30
31
|
const path = require('path');
|
|
31
32
|
const { spawn, execSync } = require('child_process');
|
|
32
33
|
|
|
@@ -37,6 +38,23 @@ const LOGS_DIR = path.join(BACKEND_DIR, 'logs');
|
|
|
37
38
|
|
|
38
39
|
const LOCAL_HOSTS = new Set(['localhost', '127.0.0.1', '::1', 'host.docker.internal']);
|
|
39
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Runners default to this machine's own LAN IP (see nodeRegister's
|
|
43
|
+
* detectLanIp), not a loopback hostname — so isLocalUrl must also recognise
|
|
44
|
+
* this machine's actual interface addresses, or a runner started and later
|
|
45
|
+
* stopped on this same box gets misclassified as remote and loses its
|
|
46
|
+
* "Start" option (nothing else can restart a fully-stopped process for it).
|
|
47
|
+
*/
|
|
48
|
+
function localAddresses() {
|
|
49
|
+
const addrs = new Set(LOCAL_HOSTS);
|
|
50
|
+
for (const ifaces of Object.values(os.networkInterfaces())) {
|
|
51
|
+
for (const iface of ifaces ?? []) {
|
|
52
|
+
if (iface.family === 'IPv4' || iface.family === 4) addrs.add(iface.address);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return addrs;
|
|
56
|
+
}
|
|
57
|
+
|
|
40
58
|
function loadRegistry() {
|
|
41
59
|
try {
|
|
42
60
|
return JSON.parse(fs.readFileSync(REGISTRY_PATH, 'utf8'));
|
|
@@ -90,7 +108,7 @@ function isAlive(pid) {
|
|
|
90
108
|
|
|
91
109
|
function isLocalUrl(url) {
|
|
92
110
|
try {
|
|
93
|
-
return
|
|
111
|
+
return localAddresses().has(new URL(url).hostname);
|
|
94
112
|
} catch {
|
|
95
113
|
return false;
|
|
96
114
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This file is part of Plum.
|
|
3
|
+
|
|
4
|
+
Plum is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
Plum is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
+
*/
|
|
17
|
+
📂 Loading tests from: /Users/silverlunah/Projects/plum/backend/tests
|
|
18
|
+
Backend running on port 3999 (node/runner mode)
|
|
@@ -139,9 +139,8 @@ async function describeRunners() {
|
|
|
139
139
|
function statusBadge(r) {
|
|
140
140
|
const dot = r.online ? pc.green('●') : pc.dim('○');
|
|
141
141
|
let detail;
|
|
142
|
-
if (
|
|
143
|
-
else if (r.
|
|
144
|
-
else if (r.online) detail = pc.yellow('running (unmanaged)');
|
|
142
|
+
if (r.managed) detail = pc.green('running');
|
|
143
|
+
else if (r.online) detail = pc.yellow(r.local ? 'running (unmanaged)' : 'running (remote)');
|
|
145
144
|
else detail = pc.dim('stopped');
|
|
146
145
|
return `${dot} ${detail}`;
|
|
147
146
|
}
|
|
@@ -184,13 +183,19 @@ async function runAction(r) {
|
|
|
184
183
|
{ value: 'restart', label: pc.yellow('Restart') },
|
|
185
184
|
{ value: 'ping', label: 'Ping' }
|
|
186
185
|
);
|
|
187
|
-
} else if (r.local) {
|
|
188
|
-
options.push({ value: 'start', label: pc.green('Start') }, { value: 'ping', label: 'Ping' });
|
|
189
186
|
} else {
|
|
190
|
-
|
|
187
|
+
// Offline and nothing is listening to control remotely — offer Start
|
|
188
|
+
// unconditionally rather than gating on address-based "is this local"
|
|
189
|
+
// detection. That heuristic breaks the moment this machine's address
|
|
190
|
+
// differs from what was registered (DHCP renewal, VPN, multiple NICs),
|
|
191
|
+
// permanently trapping an offline runner with no way back. Starting
|
|
192
|
+
// here is always safe to attempt: it spawns a managed process this menu
|
|
193
|
+
// can immediately Stop again if the address guess was wrong.
|
|
194
|
+
options.push({ value: 'start', label: pc.green('Start') }, { value: 'ping', label: 'Ping' });
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
options.push(
|
|
198
|
+
{ value: 'token', label: 'Show token' },
|
|
194
199
|
{ value: 'delete', label: pc.red('Delete') },
|
|
195
200
|
{ value: 'back', label: pc.dim('← Back') }
|
|
196
201
|
);
|
|
@@ -241,6 +246,8 @@ async function runAction(r) {
|
|
|
241
246
|
} else if (action === 'log') {
|
|
242
247
|
const entry = runnerProcess.loadRegistry()[r.id];
|
|
243
248
|
clack.note(entry?.logFile ?? '(no log file)', 'Log file');
|
|
249
|
+
} else if (action === 'token') {
|
|
250
|
+
clack.note(r.token, 'Auth token');
|
|
244
251
|
} else if (action === 'ping') {
|
|
245
252
|
const s = clack.spinner();
|
|
246
253
|
s.start(`Pinging "${r.name}"...`);
|