uplink-cli 0.1.22 → 0.1.24
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.
|
@@ -261,16 +261,18 @@ tokensCommand
|
|
|
261
261
|
"Role".padEnd(8) +
|
|
262
262
|
"Prefix".padEnd(10) +
|
|
263
263
|
"User ID".padEnd(40) +
|
|
264
|
+
"Created By".padEnd(40) +
|
|
264
265
|
"Status".padEnd(12) +
|
|
265
266
|
"Created"
|
|
266
267
|
);
|
|
267
|
-
console.log("-".repeat(
|
|
268
|
+
console.log("-".repeat(140));
|
|
268
269
|
|
|
269
270
|
for (const t of result.tokens) {
|
|
270
271
|
const id = String(t.id || "").slice(0, 16);
|
|
271
272
|
const role = String(t.role || "-").slice(0, 6);
|
|
272
273
|
const prefix = String(t.token_prefix || t.tokenPrefix || "-").slice(0, 8);
|
|
273
274
|
const userId = String(t.user_id || t.userId || "-").slice(0, 38);
|
|
275
|
+
const createdBy = String(t.created_by_user_id || t.createdByUserId || "-").slice(0, 38);
|
|
274
276
|
const status = t.revoked_at || t.revokedAt ? "revoked" : "active";
|
|
275
277
|
const created = formatDate(t.created_at || t.createdAt || "");
|
|
276
278
|
console.log(
|
|
@@ -278,6 +280,7 @@ tokensCommand
|
|
|
278
280
|
role.padEnd(8) +
|
|
279
281
|
prefix.padEnd(10) +
|
|
280
282
|
userId.padEnd(40) +
|
|
283
|
+
createdBy.padEnd(40) +
|
|
281
284
|
status.padEnd(12) +
|
|
282
285
|
created
|
|
283
286
|
);
|
|
@@ -609,7 +609,12 @@ export const menuCommand = new Command("menu")
|
|
|
609
609
|
try { process.stdin.setRawMode(false); } catch { /* ignore */ }
|
|
610
610
|
const activePorts = await scanCommonPorts();
|
|
611
611
|
|
|
612
|
-
|
|
612
|
+
// Filter out ports that already have tunnels running
|
|
613
|
+
const runningTunnels = findTunnelClients();
|
|
614
|
+
const portsWithTunnels = new Set(runningTunnels.map(t => t.port));
|
|
615
|
+
const availablePorts = activePorts.filter(p => !portsWithTunnels.has(p));
|
|
616
|
+
|
|
617
|
+
if (availablePorts.length === 0) {
|
|
613
618
|
// No ports found - show selector with just custom option and back
|
|
614
619
|
const options: SelectOption[] = [
|
|
615
620
|
{ label: "Enter custom port", value: "custom" },
|
|
@@ -631,11 +636,17 @@ export const menuCommand = new Command("menu")
|
|
|
631
636
|
return await createAndStartTunnel(port);
|
|
632
637
|
}
|
|
633
638
|
|
|
634
|
-
// Build options from found ports
|
|
635
|
-
const options: SelectOption[] =
|
|
639
|
+
// Build options from found ports (excluding those with running tunnels)
|
|
640
|
+
const options: SelectOption[] = availablePorts.map((port) => ({
|
|
636
641
|
label: `Port ${port}`,
|
|
637
642
|
value: port,
|
|
638
643
|
}));
|
|
644
|
+
// Show ports with running tunnels as info
|
|
645
|
+
if (portsWithTunnels.size > 0) {
|
|
646
|
+
for (const port of portsWithTunnels) {
|
|
647
|
+
options.push({ label: `Port ${port} (tunnel running)`, value: `skip-${port}` });
|
|
648
|
+
}
|
|
649
|
+
}
|
|
639
650
|
options.push({ label: "Enter custom port", value: "custom" });
|
|
640
651
|
|
|
641
652
|
const result = await inlineSelect("Select port to expose", options, true);
|
|
@@ -652,6 +663,10 @@ export const menuCommand = new Command("menu")
|
|
|
652
663
|
try { process.stdin.setRawMode(false); } catch { /* ignore */ }
|
|
653
664
|
const answer = await promptLine("Enter port number (default 3000): ");
|
|
654
665
|
port = Number(answer) || 3000;
|
|
666
|
+
} else if (typeof result.value === "string" && result.value.startsWith("skip-")) {
|
|
667
|
+
// Port with running tunnel selected - show info message
|
|
668
|
+
restoreRawMode();
|
|
669
|
+
return `⚠ Port ${result.value.replace("skip-", "")} already has a tunnel running.\nUse "Stop Tunnel" first to disconnect it.`;
|
|
655
670
|
} else {
|
|
656
671
|
port = result.value as number;
|
|
657
672
|
}
|
|
@@ -1007,13 +1022,16 @@ export const menuCommand = new Command("menu")
|
|
|
1007
1022
|
t.role ?? "-",
|
|
1008
1023
|
6
|
|
1009
1024
|
).padEnd(8)} ${truncate(t.label ?? "-", 20).padEnd(22)} ${truncate(
|
|
1025
|
+
t.created_by_user_id ?? t.createdByUserId ?? "-",
|
|
1026
|
+
12
|
|
1027
|
+
).padEnd(14)} ${truncate(
|
|
1010
1028
|
t.created_at ?? t.createdAt ?? "",
|
|
1011
1029
|
19
|
|
1012
1030
|
)}`
|
|
1013
1031
|
);
|
|
1014
1032
|
return [
|
|
1015
|
-
"ID Prefix Role Label Created",
|
|
1016
|
-
"-".repeat(
|
|
1033
|
+
"ID Prefix Role Label Created By Created",
|
|
1034
|
+
"-".repeat(105),
|
|
1017
1035
|
...lines,
|
|
1018
1036
|
].join("\n");
|
|
1019
1037
|
},
|
package/package.json
CHANGED