plum-e2e 2.6.3 → 2.6.4

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 LOCAL_HOSTS.has(new URL(url).hostname);
111
+ return localAddresses().has(new URL(url).hostname);
94
112
  } catch {
95
113
  return false;
96
114
  }
@@ -191,6 +191,7 @@ async function runAction(r) {
191
191
  }
192
192
 
193
193
  options.push(
194
+ { value: 'token', label: 'Show token' },
194
195
  { value: 'delete', label: pc.red('Delete') },
195
196
  { value: 'back', label: pc.dim('← Back') }
196
197
  );
@@ -241,6 +242,8 @@ async function runAction(r) {
241
242
  } else if (action === 'log') {
242
243
  const entry = runnerProcess.loadRegistry()[r.id];
243
244
  clack.note(entry?.logFile ?? '(no log file)', 'Log file');
245
+ } else if (action === 'token') {
246
+ clack.note(r.token, 'Auth token');
244
247
  } else if (action === 'ping') {
245
248
  const s = clack.spinner();
246
249
  s.start(`Pinging "${r.name}"...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plum-e2e",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/silverlunah/plum.git"