@tridha643/hestia 1.0.0 → 1.0.1

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/cli.js CHANGED
@@ -10858,6 +10858,11 @@ async function listTunnels() {
10858
10858
  connections: Array.isArray(t.connections) ? t.connections : []
10859
10859
  }));
10860
10860
  }
10861
+ async function countConnectors(uuid) {
10862
+ const out = await run(["tunnel", "info", "-o", "json", uuid]);
10863
+ const parsed = JSON.parse(out);
10864
+ return Array.isArray(parsed.conns) ? parsed.conns.length : 0;
10865
+ }
10861
10866
  async function adoptTunnel(name) {
10862
10867
  const entry = (await listTunnels()).find((t) => t.name === name);
10863
10868
  if (entry === undefined) {
@@ -11791,12 +11796,6 @@ async function tunnelChecks() {
11791
11796
  const adopted = listAdopted();
11792
11797
  if (adopted.length === 0)
11793
11798
  return rows;
11794
- let tunnels = null;
11795
- try {
11796
- tunnels = await listTunnels();
11797
- } catch {
11798
- tunnels = null;
11799
- }
11800
11799
  for (const uuid of adopted) {
11801
11800
  const ref = readAdopted(uuid);
11802
11801
  const label = `tunnel:${ref?.name ?? uuid}`;
@@ -11807,14 +11806,18 @@ async function tunnelChecks() {
11807
11806
  } else if (pf.port !== undefined) {
11808
11807
  rows.push(await isReady(pf.port) ? row(label, "ok", "connector live with an edge connection") : row(label, "warn", "connector running but no edge connection yet"));
11809
11808
  }
11810
- if (tunnels === null) {
11809
+ let connectors;
11810
+ try {
11811
+ connectors = await countConnectors(uuid);
11812
+ } catch {
11813
+ connectors = null;
11814
+ }
11815
+ if (connectors === null) {
11811
11816
  rows.push(row(`${label}:connectors`, "unknown", "cloudflare unreachable \u2014 cannot count connectors"));
11812
11817
  } else {
11813
- const info = tunnels.find((t) => t.id === uuid);
11814
- const conns = info?.connections?.length ?? 0;
11815
11818
  const expected = live ? 1 : 0;
11816
- if (conns > expected) {
11817
- rows.push(row(`${label}:connectors`, "error", `${conns} connector(s) registered but hestia runs ${expected} \u2014 a foreign ` + `replica cross-wires worktrees; stop the other cloudflared`));
11819
+ if (connectors > expected) {
11820
+ rows.push(row(`${label}:connectors`, "error", `${connectors} connector(s) registered but hestia runs ${expected} \u2014 a foreign ` + `replica cross-wires worktrees; stop the other cloudflared`));
11818
11821
  }
11819
11822
  }
11820
11823
  }
@@ -12419,7 +12422,7 @@ import { execFile as execFile11 } from "child_process";
12419
12422
  import { promisify as promisify9 } from "util";
12420
12423
  import { join as join23, resolve as resolve2 } from "path";
12421
12424
  import { createHash as createHash7 } from "crypto";
12422
- import { resolveCname } from "dns/promises";
12425
+ import { resolve4, resolve6, resolveCname } from "dns/promises";
12423
12426
  function composeUnsupported(message) {
12424
12427
  throw new HestiaError("compose-unsupported", message);
12425
12428
  }
@@ -12766,6 +12769,14 @@ async function assertNamedTunnelDns(hostname, tunnelUuid) {
12766
12769
  if (records.includes(expected.toLowerCase()))
12767
12770
  return;
12768
12771
  } catch {}
12772
+ try {
12773
+ if ((await resolve4(hostname)).length > 0)
12774
+ return;
12775
+ } catch {}
12776
+ try {
12777
+ if ((await resolve6(hostname)).length > 0)
12778
+ return;
12779
+ } catch {}
12769
12780
  throw new HestiaError("dns-route-required", `${hostname} does not resolve through Hestia's adopted tunnel; configure wildcard CNAME *.${hostname.split(".").slice(1).join(".")} -> ${expected}`, { hostname, wildcardTarget: expected });
12770
12781
  }
12771
12782
 
@@ -13569,7 +13580,7 @@ class ComposeEngine {
13569
13580
  }
13570
13581
  const adopted = await adoptTunnel(tunnelName);
13571
13582
  if (adopted.connections > 0 && !isAdopted(adopted.uuid) && !opts?.force) {
13572
- throw new HestiaError("tunnel-busy", `tunnel "${tunnelName}" already has ${adopted.connections} live ` + `connector(s) \u2014 stop the other cloudflared first (hestia's ` + `connector serves your static hostnames too), or pass --force to ` + `accept nondeterministic routing`);
13583
+ throw new HestiaError("tunnel-busy", `tunnel "${tunnelName}" already has ${adopted.connections} live edge ` + `connection(s) from a foreign connector \u2014 stop the other cloudflared first (hestia's ` + `connector serves your static hostnames too), or pass --force to ` + `accept nondeterministic routing`);
13573
13584
  }
13574
13585
  const preflightRecord = readState(worktreeRoot);
13575
13586
  if (preflightRecord === null) {
@@ -15808,7 +15819,7 @@ async function main() {
15808
15819
  switch (cmd) {
15809
15820
  case "version": {
15810
15821
  const version = {
15811
- cliVersion: "1.0.0",
15822
+ cliVersion: "1.0.1",
15812
15823
  stateSchema: STATE_SCHEMA_VERSION,
15813
15824
  daemonProtocol: HESTIAD_PROTOCOL_VERSION,
15814
15825
  runtime: "bun"
@@ -16393,4 +16404,4 @@ ${JSON.stringify(result.config, null, 2)}
16393
16404
  }
16394
16405
  main();
16395
16406
 
16396
- //# debugId=A4ADFA741120BECE64756E2164756E21
16407
+ //# debugId=7C129FA1100BA38864756E2164756E21