@getmonoceros/workbench 1.38.16 → 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 CHANGED
@@ -2861,6 +2861,21 @@ async function resolveWindowsProfile() {
2861
2861
  return null;
2862
2862
  }
2863
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
+ }
2864
2879
  async function realLockWindowsKey(winKeyPath, user) {
2865
2880
  await runCapture("icacls.exe", [
2866
2881
  winKeyPath,
@@ -9055,7 +9070,7 @@ var CLI_VERSION;
9055
9070
  var init_version = __esm({
9056
9071
  "src/version.ts"() {
9057
9072
  "use strict";
9058
- CLI_VERSION = true ? "1.38.16" : "dev";
9073
+ CLI_VERSION = true ? "1.38.17" : "dev";
9059
9074
  }
9060
9075
  });
9061
9076
 
@@ -12765,7 +12780,9 @@ async function runShare(opts) {
12765
12780
  for (const port of ports) {
12766
12781
  await preflight({ port, address: SHARE_ADDRESS });
12767
12782
  }
12768
- 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;
12769
12786
  const sans = [mdnsName, ip, "localhost", "127.0.0.1"].filter(
12770
12787
  (s) => typeof s === "string" && s.length > 0
12771
12788
  );
@@ -12792,20 +12809,18 @@ async function runShare(opts) {
12792
12809
  );
12793
12810
  const ensureImage = opts.ensureImage ?? ((image) => defaultEnsureImage(image, log));
12794
12811
  await ensureImage(CADDY_IMAGE);
12795
- const host = mdnsName ?? ip ?? "<host-ip>";
12812
+ const addresses = [ip, mdnsName].filter(
12813
+ (a) => typeof a === "string" && a.length > 0
12814
+ );
12815
+ if (addresses.length === 0) addresses.push("<host-ip>");
12796
12816
  const caPath = await caTrustDisplayPath(tls.caCertPath, home);
12797
12817
  log.info(
12798
12818
  `Sharing ${opts.name}/${opts.app} on the local network (Ctrl+C to stop):`
12799
12819
  );
12800
12820
  for (const t of ported) {
12801
- log.info(` ${cyan2(t.name)} https://${host}:${t.port}`);
12802
- }
12803
- if (mdnsName && ip) {
12804
- log.info(
12805
- dim(
12806
- ` also reachable as https://${ip}:<port> if .local does not resolve`
12807
- )
12808
- );
12821
+ for (const addr of addresses) {
12822
+ log.info(` ${cyan2(t.name)} https://${addr}:${t.port}`);
12823
+ }
12809
12824
  }
12810
12825
  log.info(
12811
12826
  dim(