Skip to content

Commit

Permalink
fix: use localhost when host is empty for getURL
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 20, 2023
1 parent d480b5e commit 9ec7d77
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/listen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,17 @@ export async function listen(
}

// --- GetURL Utility ---
const getURL = (host = listhenOptions.hostname, baseURL?: string) =>
generateURL(host, listhenOptions, baseURL);
const getURL = (
host = listhenOptions.hostname || "localhost",
baseURL?: string,
) => generateURL(host, listhenOptions, baseURL);

// --- Start Tunnel ---
let tunnel: Tunnel | undefined;
if (listhenOptions.tunnel) {
const { startTunnel } = await import("untun");
tunnel = await startTunnel({
url: getURL("localhost"),
url: getURL(),
});
}

Expand Down

0 comments on commit 9ec7d77

Please sign in to comment.