From a5c26c6f7867317ac0615a35cbc53a165e581ed6 Mon Sep 17 00:00:00 2001 From: Tom Lawton Date: Thu, 21 Sep 2023 18:34:12 +0000 Subject: [PATCH] fix(#2): localtunnel tolerates short names --- lib/extension.js | 2 +- src/extension.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/extension.js b/lib/extension.js index b92a5af..bc583e1 100644 --- a/lib/extension.js +++ b/lib/extension.js @@ -7,7 +7,7 @@ let BudLocaltunnel = class BudLocaltunnel extends Extension { #devTunnel; async configAfter(bud) { if (bud.isDevelopment) { - this.#devTunnel = await localtunnel({ subdomain: bud.context.label, local_host: bud.server?.url.hostname, port: bud.server?.url.port }); + this.#devTunnel = await localtunnel({ subdomain: bud.context.label.length > 3 ? bud.context.label : undefined, local_host: bud.server?.url.hostname, port: bud.server?.url.port }); const tunnelUrl = new URL(this.#devTunnel.url); bud.setPublicUrl(tunnelUrl); this.#devTunnel.on('close', () => { diff --git a/src/extension.ts b/src/extension.ts index 228320d..4751409 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -20,7 +20,7 @@ export default class BudLocaltunnel extends Extension< @bind public override async configAfter(bud: Bud) { if(bud.isDevelopment) { - this.#devTunnel = await localtunnel({ subdomain: bud.context.label, local_host: bud.server?.url.hostname, port: bud.server?.url.port }) + this.#devTunnel = await localtunnel({ subdomain: bud.context.label.length > 3 ? bud.context.label : undefined, local_host: bud.server?.url.hostname, port: bud.server?.url.port }) const tunnelUrl = new URL(this.#devTunnel.url);