Voice-call: fix tailscale tunnel path
This commit is contained in:
@@ -230,12 +230,13 @@ export async function startTailscaleTunnel(config: {
|
|||||||
throw new Error("Could not get Tailscale DNS name. Is Tailscale running?");
|
throw new Error("Could not get Tailscale DNS name. Is Tailscale running?");
|
||||||
}
|
}
|
||||||
|
|
||||||
const localUrl = `http://127.0.0.1:${config.port}`;
|
const path = config.path.startsWith("/") ? config.path : `/${config.path}`;
|
||||||
|
const localUrl = `http://127.0.0.1:${config.port}${path}`;
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const proc = spawn(
|
const proc = spawn(
|
||||||
"tailscale",
|
"tailscale",
|
||||||
[config.mode, "--bg", "--yes", "--set-path", config.path, localUrl],
|
[config.mode, "--bg", "--yes", "--set-path", path, localUrl],
|
||||||
{ stdio: ["ignore", "pipe", "pipe"] },
|
{ stdio: ["ignore", "pipe", "pipe"] },
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -247,7 +248,7 @@ export async function startTailscaleTunnel(config: {
|
|||||||
proc.on("close", (code) => {
|
proc.on("close", (code) => {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
const publicUrl = `https://${dnsName}${config.path}`;
|
const publicUrl = `https://${dnsName}${path}`;
|
||||||
console.log(
|
console.log(
|
||||||
`[voice-call] Tailscale ${config.mode} active: ${publicUrl}`,
|
`[voice-call] Tailscale ${config.mode} active: ${publicUrl}`,
|
||||||
);
|
);
|
||||||
@@ -256,7 +257,7 @@ export async function startTailscaleTunnel(config: {
|
|||||||
publicUrl,
|
publicUrl,
|
||||||
provider: `tailscale-${config.mode}`,
|
provider: `tailscale-${config.mode}`,
|
||||||
stop: async () => {
|
stop: async () => {
|
||||||
await stopTailscaleTunnel(config.mode, config.path);
|
await stopTailscaleTunnel(config.mode, path);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user