@brett_lamy/ui 5.10.0 → 5.10.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.
@@ -1 +1 @@
1
- {"version":3,"file":"tailscale-connect.d.ts","sourceRoot":"","sources":["../../src/lib/tailscale-connect.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAwD,MAAM,iBAAiB,CAAC;AAEnI,uGAAuG;AACvG,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,SAAS,EAAE;QACb,WAAW,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;QACnD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;QACvC,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QACzC,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;KAC7C,GAAG,IAAI,CAAC;IACT,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,IAAI,IAAI,CAAC;IACf,wEAAwE;IACxE,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAC5K,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAA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AC,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC7C;+HAC2H;IAC3H,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;6GAEyG;IACzG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;0HACsH;IACtH,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,KAAK,CAAC;IACxB;;;oEAGgE;IAChE,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAClC;;uGAEmG;IACnG,cAAc,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;CACnD;AAED,yHAAyH;AACzH,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAavD;;wHAEwH;AACxH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,QA8DhD;AA4BD;2GAC2G;AAC3G,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAY7D;AAsBD;;uFAEuF;AACvF,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAG3E;AAGD,qHAAqH;AACrH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGlD;AAED,+FAA+F;AAC/F,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,uBAAuB,GAAG,eAAe,CA6L9F"}
@@ -32,7 +32,10 @@ function n(n) {
32
32
  blocks: Math.ceil(t.length / 512),
33
33
  atimeMs: e,
34
34
  mtimeMs: e,
35
- ctimeMs: e
35
+ ctimeMs: e,
36
+ isDirectory: () => !1,
37
+ isFile: () => !0,
38
+ isSymbolicLink: () => !1
36
39
  };
37
40
  }, c = (e) => e === "/etc/ssl/cert.pem" && t !== null;
38
41
  r.fs = Object.assign(Object.create(i), {
@@ -140,9 +143,9 @@ function u(e) {
140
143
  return t.includes(".") && !l.test(t) && !t.includes(":") && !t.startsWith("[") && !t.endsWith(".ts.net") && t !== "localhost" && !t.endsWith(".localhost");
141
144
  }
142
145
  function d(e) {
143
- let t = null, d = !1, f = null, p = () => {}, m = /* @__PURE__ */ new Map(), h = {};
144
- async function g(n) {
145
- let r = m.get(n);
146
+ let t = null, d = !1, m = null, h = () => {}, g = /* @__PURE__ */ new Map(), _ = {};
147
+ async function v(n) {
148
+ let r = g.get(n);
146
149
  if (r && r.until > Date.now()) return r.ip;
147
150
  let i = e.dnsVia === "exit-node", a = new URL(e.dohUrl ?? (i ? "https://1.1.1.1/dns-query" : "https://cloudflare-dns.com/dns-query"));
148
151
  a.searchParams.set("name", n), a.searchParams.set("type", "A");
@@ -161,14 +164,14 @@ function d(e) {
161
164
  if (o !== 200) throw Error(`DNS lookup for ${n} failed (HTTP ${o}).`);
162
165
  let u = JSON.parse(c).Answer?.find((e) => e.type === 1 && typeof e.data == "string" && l.test(e.data));
163
166
  if (!u?.data) throw Error(`${n} has no address to look up.`);
164
- return m.set(n, {
167
+ return g.set(n, {
165
168
  ip: u.data,
166
169
  until: Date.now() + Math.min(Math.max(u.TTL ?? 60, 30), 300) * 1e3
167
170
  }), u.data;
168
171
  }
169
- let _ = () => t?.configure?.({
170
- ...c(f),
171
- ...Object.keys(h).length ? { ipMap: { ...h } } : {}
172
+ let y = () => t?.configure?.({
173
+ ...c(m),
174
+ ...Object.keys(_).length ? { ipMap: { ..._ } } : {}
172
175
  });
173
176
  return {
174
177
  async start(o) {
@@ -176,8 +179,8 @@ function d(e) {
176
179
  let [s, l] = await Promise.all([(e.load ?? (() => import("@agent-wasm/tailscale-connect")))(), typeof e.caCertificates == "string" ? e.caCertificates : e.caCertificates ? e.caCertificates() : import("./tailscale-roots.js").then((e) => e.default)]);
177
180
  n(l);
178
181
  let u = new Map(Object.entries(o.state ?? {}));
179
- o.exitNodeId && (f = o.exitNodeId), p = r();
180
- let m = await s.createIPN({
182
+ o.exitNodeId && (m = o.exitNodeId), h = r();
183
+ let f = await s.createIPN({
181
184
  authKey: o.authKey ?? "",
182
185
  controlURL: o.controlUrl,
183
186
  hostname: o.hostname,
@@ -189,24 +192,24 @@ function d(e) {
189
192
  }
190
193
  },
191
194
  panicHandler: (e) => {
192
- p(), o.onEvent({ error: e });
195
+ h(), o.onEvent({ error: e });
193
196
  },
194
197
  ...a(e.acceptDns !== !1),
195
- ...f ? c(f) : {}
198
+ ...m ? c(m) : {}
196
199
  });
197
- d || (t = m, m.run({
200
+ d || (t = f, f.run({
198
201
  notifyState: (e) => o.onEvent({ state: e }),
199
202
  notifyNetMap: (e) => {
200
203
  try {
201
204
  let t = JSON.parse(e);
202
- t.selectedExitNodeId !== void 0 && (f = t.selectedExitNodeId), o.onEvent({ netMap: t });
205
+ t.selectedExitNodeId !== void 0 && (m = t.selectedExitNodeId), o.onEvent({ netMap: t });
203
206
  } catch {
204
207
  o.onEvent({ netMap: null });
205
208
  }
206
209
  },
207
210
  notifyBrowseToURL: (e) => o.onEvent({ loginUrl: e }),
208
211
  notifyPanicRecover: (e) => {
209
- p(), o.onEvent({ error: e });
212
+ h(), o.onEvent({ error: e });
210
213
  }
211
214
  }));
212
215
  },
@@ -219,60 +222,92 @@ function d(e) {
219
222
  async setExitNode(e) {
220
223
  if (!t) throw Error("The Tailscale client is not running.");
221
224
  if (!t.configure) throw Error("This build of the Tailscale client cannot change its exit node.");
222
- f = e, await _(), m.clear();
225
+ m = e, await y(), g.clear();
223
226
  },
224
- async fetch(n) {
227
+ async fetch(e) {
225
228
  if (!t) throw Error("The Tailscale client is not running.");
226
- let r = (n.method ?? "GET").toUpperCase(), i = new URL(n.url), a = f !== null && u(i.hostname), c = !a && r === "GET" && !n.body && !n.headers?.length && (n.redirect ?? "follow") === "follow", l = Object.fromEntries(n.headers ?? []), d = (e, t = {}) => ({
227
- url: e,
228
- method: r,
229
- headers: l,
230
- bodyBase64: n.body ? o(n.body) : void 0,
231
- redirect: n.redirect,
232
- ...t
233
- }), p;
234
- if (a) {
235
- let r = await g(i.hostname), a = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : e?.message ?? String(e), o = () => {
236
- let e = new URL(n.url);
237
- e.hostname = r;
238
- let a = { ...l };
239
- for (let e of Object.keys(a)) e.toLowerCase() === "host" && delete a[e];
240
- return a.Host = i.host, t.fetch({
241
- ...d(e.href),
242
- headers: a,
243
- ...i.protocol === "https:" ? { tlsServerName: i.hostname } : {}
244
- });
245
- };
246
- if (e.exitNodeDial === "name") {
247
- h[i.hostname] !== r && (h[i.hostname] = r, await _());
248
- try {
249
- p = await t.fetch(d(n.url));
250
- } catch (e) {
251
- try {
252
- p = await o();
253
- } catch (t) {
254
- throw Error(`${i.hostname} (${r}) could not be fetched through the exit node. Fetching the name: ${a(e)}. Fetching the address: ${a(t)}.`);
255
- }
256
- }
257
- } else try {
258
- p = await o();
259
- } catch (e) {
260
- throw Error(`${i.hostname} (${r}) could not be fetched through the exit node: ${a(e)}.`);
261
- }
262
- } else p = await t.fetch(c ? n.url : d(n.url));
263
- let m = p.bodyBase64 === void 0 ? p.text ? new TextEncoder().encode(await p.text()) : null : s(p.bodyBase64);
264
- return {
265
- url: a ? n.url : p.url ?? n.url,
266
- status: p.status,
267
- statusText: p.statusText ?? "",
268
- headers: Object.entries(p.headers ?? {}),
269
- body: m
229
+ if (m === null || (e.redirect ?? "follow") !== "follow" || !u(new URL(e.url).hostname)) return b(e);
230
+ let n = {
231
+ ...e,
232
+ redirect: "manual"
270
233
  };
234
+ for (let t = 0;; t++) {
235
+ let r = await b(n), i = f.has(r.status) ? r.headers.find(([e]) => e.toLowerCase() === "location")?.[1] : void 0;
236
+ if (!i) return r;
237
+ if (t >= p) throw Error(`${e.url} redirected more than ${p} times.`);
238
+ let a = new URL(i, n.url);
239
+ if (a.protocol !== "http:" && a.protocol !== "https:") return r;
240
+ n = (r.status === 303 ? (n.method ?? "GET").toUpperCase() !== "HEAD" : (r.status === 301 || r.status === 302) && (n.method ?? "GET").toUpperCase() === "POST") ? {
241
+ ...n,
242
+ url: a.href,
243
+ method: "GET",
244
+ body: null,
245
+ headers: n.headers?.filter(([e]) => !/^content-/i.test(e))
246
+ } : {
247
+ ...n,
248
+ url: a.href
249
+ };
250
+ }
271
251
  },
272
252
  dispose() {
273
- d = !0, t = null, p();
253
+ d = !0, t = null, h();
274
254
  }
275
255
  };
256
+ async function b(n) {
257
+ if (!t) throw Error("The Tailscale client is not running.");
258
+ let r = (n.method ?? "GET").toUpperCase(), i = new URL(n.url), a = m !== null && u(i.hostname), c = !a && r === "GET" && !n.body && !n.headers?.length && (n.redirect ?? "follow") === "follow", l = Object.fromEntries(n.headers ?? []), d = (e, t = {}) => ({
259
+ url: e,
260
+ method: r,
261
+ headers: l,
262
+ bodyBase64: n.body ? o(n.body) : void 0,
263
+ redirect: n.redirect,
264
+ ...t
265
+ }), f;
266
+ if (a) {
267
+ let r = await v(i.hostname), a = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : e?.message ?? String(e), o = () => {
268
+ let e = new URL(n.url);
269
+ e.hostname = r;
270
+ let a = { ...l };
271
+ for (let e of Object.keys(a)) e.toLowerCase() === "host" && delete a[e];
272
+ return a.Host = i.host, t.fetch({
273
+ ...d(e.href),
274
+ headers: a,
275
+ ...i.protocol === "https:" ? { tlsServerName: i.hostname } : {}
276
+ });
277
+ };
278
+ if (e.exitNodeDial === "name") {
279
+ _[i.hostname] !== r && (_[i.hostname] = r, await y());
280
+ try {
281
+ f = await t.fetch(d(n.url));
282
+ } catch (e) {
283
+ try {
284
+ f = await o();
285
+ } catch (t) {
286
+ throw Error(`${i.hostname} (${r}) could not be fetched through the exit node. Fetching the name: ${a(e)}. Fetching the address: ${a(t)}.`);
287
+ }
288
+ }
289
+ } else try {
290
+ f = await o();
291
+ } catch (e) {
292
+ throw Error(`${i.hostname} (${r}) could not be fetched through the exit node: ${a(e)}.`);
293
+ }
294
+ } else f = await t.fetch(c ? n.url : d(n.url));
295
+ let p = f.bodyBase64 === void 0 ? f.text ? new TextEncoder().encode(await f.text()) : null : s(f.bodyBase64);
296
+ return {
297
+ url: a ? n.url : f.url ?? n.url,
298
+ status: f.status,
299
+ statusText: f.statusText ?? "",
300
+ headers: Object.entries(f.headers ?? {}),
301
+ body: p
302
+ };
303
+ }
276
304
  }
305
+ var f = /* @__PURE__ */ new Set([
306
+ 301,
307
+ 302,
308
+ 303,
309
+ 307,
310
+ 308
311
+ ]), p = 20;
277
312
  //#endregion
278
313
  export { e as TAILSCALE_CERT_FILE, d as createTailscaleConnectClient, c as exitNodeSettings, n as installTailscaleRoots, u as isPublicName, i as keepCorpDns };
@@ -41,7 +41,7 @@ export interface ResolvedTailscalePolicy {
41
41
  maxBodyBytes: number;
42
42
  timeoutMs: number;
43
43
  }
44
- export type TailscaleMatchReason = 'tailnet-name' | 'tailnet-address' | 'host' | 'cidr' | 'short-name' | 'all' | 'invalid-url' | 'scheme' | 'same-origin' | 'loopback' | 'method' | 'excluded' | 'no-match';
44
+ export type TailscaleMatchReason = 'tailnet-name' | 'tailnet-address' | 'host' | 'cidr' | 'short-name' | 'all' | 'invalid-url' | 'scheme' | 'same-origin' | 'loopback' | 'tailscale' | 'method' | 'excluded' | 'no-match';
45
45
  export interface TailscaleMatch {
46
46
  route: boolean;
47
47
  reason: TailscaleMatchReason;
@@ -59,7 +59,7 @@ export declare function resolveTailscalePolicy(policy?: TailscalePolicy): Resolv
59
59
  /**
60
60
  * Would a request for `url` be routed? `origin` is the page's origin (to leave its own requests alone).
61
61
  * Decisions are made in a fixed order, so `reason` says which rule decided: not a URL, scheme, same origin, loopback,
62
- * method, `exclude`, then the inclusions.
62
+ * Tailscale's own services, method, `exclude`, then the inclusions.
63
63
  */
64
64
  export declare function matchTailscalePolicy(url: string | URL, method: string, policy: ResolvedTailscalePolicy, origin?: string): TailscaleMatch;
65
65
  /** The resolved policy as the `p` query parameter of the worker's script URL (the worker reads it back, so it cannot be changed by a message). */
@@ -1 +1 @@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,MAAM,CAW/E"}
@@ -154,8 +154,8 @@ function S(r = {}) {
154
154
  function C(e, t) {
155
155
  return typeof e == "number" && Number.isFinite(e) && e > 0 ? Math.floor(e) : t;
156
156
  }
157
- var w = (e, t) => e === "localhost" || e.endsWith(".localhost") || t !== null && (c(t, d) || c(t, f));
158
- function T(e, t, n, r) {
157
+ var w = (e) => /(^|\.)tailscale\.(com|io)$/.test(e), T = (e, t) => e === "localhost" || e.endsWith(".localhost") || t !== null && (c(t, d) || c(t, f));
158
+ function E(e, t, n, r) {
159
159
  let i;
160
160
  try {
161
161
  i = typeof e == "string" ? new URL(e, r) : e;
@@ -175,13 +175,16 @@ function T(e, t, n, r) {
175
175
  reason: "same-origin"
176
176
  };
177
177
  let s = i.hostname.toLowerCase(), d = o(s);
178
- return w(s, d) ? {
178
+ return T(s, d) ? {
179
179
  route: !1,
180
180
  reason: "loopback"
181
+ } : w(s) ? {
182
+ route: !1,
183
+ reason: "tailscale"
181
184
  } : n.methods && !n.methods.includes(t.toUpperCase()) ? {
182
185
  route: !1,
183
186
  reason: "method"
184
- } : E(s, d, n.exclude) ? {
187
+ } : D(s, d, n.exclude) ? {
185
188
  route: !1,
186
189
  reason: "excluded"
187
190
  } : n.intercept === "all" ? {
@@ -193,10 +196,10 @@ function T(e, t, n, r) {
193
196
  } : d && (c(d, l) || c(d, u)) ? {
194
197
  route: !0,
195
198
  reason: "tailnet-address"
196
- } : E(s, d, n.hosts) ? {
199
+ } : D(s, d, n.hosts) ? {
197
200
  route: !0,
198
201
  reason: "host"
199
- } : E(s, d, n.cidrs) ? {
202
+ } : D(s, d, n.cidrs) ? {
200
203
  route: !0,
201
204
  reason: "cidr"
202
205
  } : n.shortNames && d === null && !s.includes(".") && s !== "" ? {
@@ -207,38 +210,38 @@ function T(e, t, n, r) {
207
210
  reason: "no-match"
208
211
  };
209
212
  }
210
- function E(e, t, n) {
213
+ function D(e, t, n) {
211
214
  for (let r of n) if (r.includes("/")) {
212
215
  let e = s(r);
213
216
  if (e && t && c(t, e)) return !0;
214
217
  } else if (_(e, r)) return !0;
215
218
  return !1;
216
219
  }
217
- function D(e) {
220
+ function O(e) {
218
221
  let t = "";
219
222
  for (let n = 0; n < e.length; n += 32768) t += String.fromCharCode(...e.subarray(n, n + 32768));
220
223
  return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
221
224
  }
222
- function O(e) {
225
+ function k(e) {
223
226
  let t = atob(e.replace(/-/g, "+").replace(/_/g, "/"));
224
227
  return Uint8Array.from(t, (e) => e.charCodeAt(0));
225
228
  }
226
- function k(e) {
227
- return D(new TextEncoder().encode(JSON.stringify(e)));
228
- }
229
229
  function A(e) {
230
+ return O(new TextEncoder().encode(JSON.stringify(e)));
231
+ }
232
+ function j(e) {
230
233
  try {
231
- let t = JSON.parse(new TextDecoder().decode(O(e)));
234
+ let t = JSON.parse(new TextDecoder().decode(k(e)));
232
235
  return !t || typeof t != "object" || t.v !== 1 ? null : S(t);
233
236
  } catch {
234
237
  return null;
235
238
  }
236
239
  }
237
- function j(e) {
240
+ function M(e) {
238
241
  let t = [];
239
242
  e.intercept === "all" ? t.push("every cross-origin request") : (t.push("*.ts.net and Tailscale addresses"), e.hosts.length && t.push(e.hosts.join(", ")), e.cidrs.length && t.push(e.cidrs.join(", ")), e.shortNames && t.push("short names"));
240
243
  let n = `Routes ${t.join(", ")}`;
241
244
  return e.exclude.length ? `${n}, except ${e.exclude.join(", ")}.` : `${n}.`;
242
245
  }
243
246
  //#endregion
244
- export { t as DEFAULT_MAX_BODY_BYTES, n as DEFAULT_TIMEOUT_MS, e as TailscalePolicyError, A as decodeTailscalePolicy, j as describeTailscalePolicy, k as encodeTailscalePolicy, p as isTailnetAddress, m as isTailnetHost, T as matchTailscalePolicy, S as resolveTailscalePolicy };
247
+ export { t as DEFAULT_MAX_BODY_BYTES, n as DEFAULT_TIMEOUT_MS, e as TailscalePolicyError, j as decodeTailscalePolicy, M as describeTailscalePolicy, A as encodeTailscalePolicy, p as isTailnetAddress, m as isTailnetHost, E as matchTailscalePolicy, S as resolveTailscalePolicy };
@@ -118,6 +118,7 @@
118
118
  const host = u.hostname.toLowerCase();
119
119
  const addr = parseAddress(host);
120
120
  if (host === 'localhost' || host.endsWith('.localhost') || (addr && (inCidr(addr, LOOPBACK_V4) || inCidr(addr, LOOPBACK_V6)))) return { route: false, reason: 'loopback' };
121
+ if (/(^|\.)tailscale\.(com|io)$/.test(host)) return { route: false, reason: 'tailscale' };
121
122
  if (policy.methods && policy.methods.indexOf(method.toUpperCase()) < 0) return { route: false, reason: 'method' };
122
123
  if (hostIn(host, addr, policy.exclude)) return { route: false, reason: 'excluded' };
123
124
  if (policy.intercept === 'all') return { route: true, reason: 'all' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brett_lamy/ui",
3
- "version": "5.10.0",
3
+ "version": "5.10.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",