airloom 0.1.32 → 0.1.33

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2176,8 +2176,8 @@ function parseRelayUrl(value) {
2176
2176
  }
2177
2177
  return parsed.toString();
2178
2178
  }
2179
- function parseHostBind(value, isDev) {
2180
- const bind = value?.trim() || (isDev ? "0.0.0.0" : DEFAULT_HOST_BIND);
2179
+ function parseHostBind(value, isDev, isSSH) {
2180
+ const bind = value?.trim() || (isDev || isSSH ? "0.0.0.0" : DEFAULT_HOST_BIND);
2181
2181
  if (bind === "localhost" || isIP(bind) !== 0) return bind;
2182
2182
  if (/^[A-Za-z0-9.-]+$/.test(bind)) return bind;
2183
2183
  throw new Error("HOST_BIND must be localhost, an IP address, or a hostname");
@@ -2186,11 +2186,12 @@ function isLoopbackBind(bind) {
2186
2186
  return bind === "127.0.0.1" || bind === "::1" || bind === "localhost";
2187
2187
  }
2188
2188
  function parseHostEnv(cliPort, isDev = false) {
2189
+ const isSSH = !!(process.env.SSH_CONNECTION || process.env.SSH_TTY || process.env.SSH_CLIENT);
2189
2190
  const relayUrl = parseRelayUrl(process.env.RELAY_URL);
2190
2191
  const ablyApiKey = process.env.ABLY_API_KEY ?? (relayUrl ? void 0 : DEFAULT_ABLY_KEY);
2191
2192
  const ablyTokenTtlMs = parseInteger("ABLY_TOKEN_TTL", process.env.ABLY_TOKEN_TTL, DEFAULT_ABLY_TOKEN_TTL_MS, 6e4, 31 * 24 * 60 * 60 * 1e3);
2192
2193
  const hostPort = cliPort ?? parseInteger("HOST_PORT", process.env.HOST_PORT, DEFAULT_HOST_PORT, 0, 65535);
2193
- const hostBind = parseHostBind(process.env.HOST_BIND, isDev);
2194
+ const hostBind = parseHostBind(process.env.HOST_BIND, isDev, isSSH);
2194
2195
  const viewerUrl = parseViewerUrl(process.env.VIEWER_URL);
2195
2196
  return {
2196
2197
  viewerUrl,
@@ -2200,7 +2201,8 @@ function parseHostEnv(cliPort, isDev = false) {
2200
2201
  hostPort,
2201
2202
  hostBind,
2202
2203
  useAbly: !!ablyApiKey,
2203
- isDefaultAblyKey: !!ablyApiKey && ablyApiKey === DEFAULT_ABLY_KEY
2204
+ isDefaultAblyKey: !!ablyApiKey && ablyApiKey === DEFAULT_ABLY_KEY,
2205
+ isSSH
2204
2206
  };
2205
2207
  }
2206
2208
 
@@ -2517,12 +2519,15 @@ async function main() {
2517
2519
  if (lanViewerUrl) console.log(`LAN Viewer: ${lanViewerUrl}`);
2518
2520
  }
2519
2521
  if (!useAbly) console.log(`Relay: ${RELAY_URL}`);
2520
- const localUrl = `http://localhost:${port}`;
2521
- const controlUrl = encodeControlUrl(localUrl, controlToken);
2522
+ const controlBase = isLoopbackBind(HOST_BIND) ? `http://localhost:${port}` : lanBaseUrl;
2523
+ const controlUrl = encodeControlUrl(controlBase, controlToken);
2522
2524
  console.log(`Host UI: ${controlUrl}`);
2523
- const isSSH = !!(process.env.SSH_CONNECTION || process.env.SSH_TTY || process.env.SSH_CLIENT);
2524
- if (isSSH) {
2525
- console.log("\n (SSH session detected \u2014 open the Host UI URL above in a local browser)");
2525
+ if (env.isSSH) {
2526
+ if (isLoopbackBind(HOST_BIND)) {
2527
+ console.log("\n (SSH session detected but server is bound to localhost \u2014 set HOST_BIND=0.0.0.0 to allow remote access)");
2528
+ } else {
2529
+ console.log("\n (SSH session \u2014 open the Host UI URL above in a browser on your local machine)");
2530
+ }
2526
2531
  } else {
2527
2532
  import("node:child_process").then(({ exec }) => {
2528
2533
  const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "airloom",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "Run AI on your computer, control it from your phone. E2E encrypted.",
5
5
  "type": "module",
6
6
  "bin": {