@getmonoceros/workbench 1.38.15 → 1.38.17
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.
- package/dist/bin.js +36 -19
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -1977,17 +1977,19 @@ async function ensureProxy(opts = {}) {
|
|
|
1977
1977
|
async function maybeStopProxy(opts = {}) {
|
|
1978
1978
|
const docker = opts.docker ?? realDocker;
|
|
1979
1979
|
const logger = opts.logger;
|
|
1980
|
-
const inspect = await docker([
|
|
1981
|
-
"network",
|
|
1982
|
-
"inspect",
|
|
1983
|
-
PROXY_NETWORK_NAME,
|
|
1984
|
-
"--format",
|
|
1985
|
-
"{{range $k, $v := .Containers}}{{$v.Name}}\n{{end}}"
|
|
1986
|
-
]);
|
|
1980
|
+
const inspect = await docker(["network", "inspect", PROXY_NETWORK_NAME]);
|
|
1987
1981
|
if (inspect.exitCode !== 0) {
|
|
1988
1982
|
return;
|
|
1989
1983
|
}
|
|
1990
|
-
const
|
|
1984
|
+
const attached = await docker([
|
|
1985
|
+
"ps",
|
|
1986
|
+
"-a",
|
|
1987
|
+
"--filter",
|
|
1988
|
+
`network=${PROXY_NETWORK_NAME}`,
|
|
1989
|
+
"--format",
|
|
1990
|
+
"{{.Names}}"
|
|
1991
|
+
]);
|
|
1992
|
+
const others = attached.stdout.split("\n").map((n) => n.trim()).filter((n) => n.length > 0 && n !== PROXY_CONTAINER_NAME);
|
|
1991
1993
|
if (others.length > 0) return;
|
|
1992
1994
|
await docker(["rm", "-f", PROXY_CONTAINER_NAME]);
|
|
1993
1995
|
const netRm = await docker(["network", "rm", PROXY_NETWORK_NAME]);
|
|
@@ -2859,6 +2861,21 @@ async function resolveWindowsProfile() {
|
|
|
2859
2861
|
return null;
|
|
2860
2862
|
}
|
|
2861
2863
|
}
|
|
2864
|
+
async function resolveWindowsLanIp() {
|
|
2865
|
+
if (!isWsl()) return null;
|
|
2866
|
+
try {
|
|
2867
|
+
const r = await runCapture("powershell.exe", [
|
|
2868
|
+
"-NoProfile",
|
|
2869
|
+
"-Command",
|
|
2870
|
+
'(Get-NetIPConfiguration | ? { $_.IPv4DefaultGateway -and $_.NetAdapter.Status -eq "Up" } | Select-Object -First 1 -ExpandProperty IPv4Address).IPAddress'
|
|
2871
|
+
]);
|
|
2872
|
+
if (r.exitCode !== 0) return null;
|
|
2873
|
+
const ip = r.stdout.replace(/\r/g, "").trim();
|
|
2874
|
+
return /^\d{1,3}(\.\d{1,3}){3}$/.test(ip) ? ip : null;
|
|
2875
|
+
} catch {
|
|
2876
|
+
return null;
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2862
2879
|
async function realLockWindowsKey(winKeyPath, user) {
|
|
2863
2880
|
await runCapture("icacls.exe", [
|
|
2864
2881
|
winKeyPath,
|
|
@@ -9053,7 +9070,7 @@ var CLI_VERSION;
|
|
|
9053
9070
|
var init_version = __esm({
|
|
9054
9071
|
"src/version.ts"() {
|
|
9055
9072
|
"use strict";
|
|
9056
|
-
CLI_VERSION = true ? "1.38.
|
|
9073
|
+
CLI_VERSION = true ? "1.38.17" : "dev";
|
|
9057
9074
|
}
|
|
9058
9075
|
});
|
|
9059
9076
|
|
|
@@ -12763,7 +12780,9 @@ async function runShare(opts) {
|
|
|
12763
12780
|
for (const port of ports) {
|
|
12764
12781
|
await preflight({ port, address: SHARE_ADDRESS });
|
|
12765
12782
|
}
|
|
12766
|
-
const { ip, mdnsName } = (opts.hostAddresses ?? realHostAddresses)();
|
|
12783
|
+
const { ip: localIp, mdnsName } = (opts.hostAddresses ?? realHostAddresses)();
|
|
12784
|
+
const winLanIp = await (opts.resolveWindowsLanIp ?? resolveWindowsLanIp)();
|
|
12785
|
+
const ip = winLanIp ?? localIp;
|
|
12767
12786
|
const sans = [mdnsName, ip, "localhost", "127.0.0.1"].filter(
|
|
12768
12787
|
(s) => typeof s === "string" && s.length > 0
|
|
12769
12788
|
);
|
|
@@ -12790,20 +12809,18 @@ async function runShare(opts) {
|
|
|
12790
12809
|
);
|
|
12791
12810
|
const ensureImage = opts.ensureImage ?? ((image) => defaultEnsureImage(image, log));
|
|
12792
12811
|
await ensureImage(CADDY_IMAGE);
|
|
12793
|
-
const
|
|
12812
|
+
const addresses = [ip, mdnsName].filter(
|
|
12813
|
+
(a) => typeof a === "string" && a.length > 0
|
|
12814
|
+
);
|
|
12815
|
+
if (addresses.length === 0) addresses.push("<host-ip>");
|
|
12794
12816
|
const caPath = await caTrustDisplayPath(tls.caCertPath, home);
|
|
12795
12817
|
log.info(
|
|
12796
12818
|
`Sharing ${opts.name}/${opts.app} on the local network (Ctrl+C to stop):`
|
|
12797
12819
|
);
|
|
12798
12820
|
for (const t of ported) {
|
|
12799
|
-
|
|
12800
|
-
}
|
|
12801
|
-
|
|
12802
|
-
log.info(
|
|
12803
|
-
dim(
|
|
12804
|
-
` also reachable as https://${ip}:<port> if .local does not resolve`
|
|
12805
|
-
)
|
|
12806
|
-
);
|
|
12821
|
+
for (const addr of addresses) {
|
|
12822
|
+
log.info(` ${cyan2(t.name)} https://${addr}:${t.port}`);
|
|
12823
|
+
}
|
|
12807
12824
|
}
|
|
12808
12825
|
log.info(
|
|
12809
12826
|
dim(
|