@le-space/ui 0.9.0 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@le-space/ui",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Floating Aleph Relay Button UI components for Svelte and React.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,8 +44,8 @@
44
44
  "url": "https://github.com/NiKrause/relay-button/issues"
45
45
  },
46
46
  "dependencies": {
47
- "@le-space/browser": "0.9.0",
48
- "@le-space/core": "0.9.0",
47
+ "@le-space/browser": "0.9.1",
48
+ "@le-space/core": "0.9.1",
49
49
  "viem": "^2.53.1"
50
50
  },
51
51
  "peerDependencies": {
package/react/index.js CHANGED
@@ -43,7 +43,7 @@ var RECENT_INSTANCE_RUNTIME_GRACE_MS = 10 * 60 * 1e3;
43
43
  var DEPLOYMENT_PENDING_WARNING_MS = 3 * 60 * 1e3;
44
44
 
45
45
  // src/shared/package-version.ts
46
- var UI_PACKAGE_VERSION = "0.9.0";
46
+ var UI_PACKAGE_VERSION = "0.9.1";
47
47
 
48
48
  // src/shared/format.ts
49
49
  function shortHash(value, head = 8, tail = 6) {
@@ -4116,6 +4116,17 @@ function hostnameOfUrl(value) {
4116
4116
  return null;
4117
4117
  }
4118
4118
  }
4119
+ var INSTANCE_ADDRESS_TIMEOUT_MS = 1e4;
4120
+ function describeInstanceAddressFailure(error, sourceUrl) {
4121
+ const raw = error instanceof Error ? error.message : String(error);
4122
+ if (error instanceof Error && error.name === "AbortError") {
4123
+ return `${sourceUrl} did not answer within ${INSTANCE_ADDRESS_TIMEOUT_MS / 1e3}s. Press Refresh to try again.`;
4124
+ }
4125
+ if (error instanceof TypeError || /failed to fetch|load failed|networkerror/i.test(raw)) {
4126
+ return `${sourceUrl} closed the connection without answering. Relays built before rootfs 0.8.0 do not serve an address document, and their proxy hangs up instead of returning 404 \u2014 redeploying from a current rootfs fixes it. (${raw})`;
4127
+ }
4128
+ return raw;
4129
+ }
4119
4130
  function emptyInstanceAddresses() {
4120
4131
  return {
4121
4132
  status: "idle",
@@ -6488,14 +6499,21 @@ var SponsorRelayController = class {
6488
6499
  sourceUrl,
6489
6500
  error: null
6490
6501
  });
6502
+ const abort = new AbortController();
6503
+ const timeout = globalThis.setTimeout(
6504
+ () => abort.abort(),
6505
+ INSTANCE_ADDRESS_TIMEOUT_MS
6506
+ );
6491
6507
  try {
6492
- const abort = new AbortController();
6493
- const timeout = globalThis.setTimeout(() => abort.abort(), 1e4);
6494
- const response = await fetch(sourceUrl, {
6495
- cache: "no-cache",
6496
- signal: abort.signal
6497
- });
6498
- globalThis.clearTimeout(timeout);
6508
+ let response;
6509
+ try {
6510
+ response = await fetch(sourceUrl, {
6511
+ cache: "no-cache",
6512
+ signal: abort.signal
6513
+ });
6514
+ } finally {
6515
+ globalThis.clearTimeout(timeout);
6516
+ }
6499
6517
  if (response.status === 404) {
6500
6518
  this.patchInstanceAddresses(instanceHash, {
6501
6519
  ...emptyInstanceAddresses(),
@@ -6522,7 +6540,7 @@ var SponsorRelayController = class {
6522
6540
  ...this.state.instanceAddresses[instanceHash] ?? emptyInstanceAddresses(),
6523
6541
  status: "error",
6524
6542
  sourceUrl,
6525
- error: error instanceof Error ? error.message : String(error)
6543
+ error: describeInstanceAddressFailure(error, sourceUrl)
6526
6544
  });
6527
6545
  }
6528
6546
  }
package/shared/index.d.ts CHANGED
@@ -397,7 +397,7 @@ declare const STALE_INSTANCE_ALLOCATION_COOLDOWN_MS: number;
397
397
  declare const RECENT_INSTANCE_RUNTIME_GRACE_MS: number;
398
398
  declare const DEPLOYMENT_PENDING_WARNING_MS: number;
399
399
 
400
- declare const UI_PACKAGE_VERSION = "0.9.0";
400
+ declare const UI_PACKAGE_VERSION = "0.9.1";
401
401
 
402
402
  interface RootfsRequiredPortForward {
403
403
  port: number;
package/shared/index.js CHANGED
@@ -42,7 +42,7 @@ var RECENT_INSTANCE_RUNTIME_GRACE_MS = 10 * 60 * 1e3;
42
42
  var DEPLOYMENT_PENDING_WARNING_MS = 3 * 60 * 1e3;
43
43
 
44
44
  // src/shared/package-version.ts
45
- var UI_PACKAGE_VERSION = "0.9.0";
45
+ var UI_PACKAGE_VERSION = "0.9.1";
46
46
 
47
47
  // src/shared/format.ts
48
48
  function shortHash(value, head = 8, tail = 6) {
@@ -4115,6 +4115,17 @@ function hostnameOfUrl(value) {
4115
4115
  return null;
4116
4116
  }
4117
4117
  }
4118
+ var INSTANCE_ADDRESS_TIMEOUT_MS = 1e4;
4119
+ function describeInstanceAddressFailure(error, sourceUrl) {
4120
+ const raw = error instanceof Error ? error.message : String(error);
4121
+ if (error instanceof Error && error.name === "AbortError") {
4122
+ return `${sourceUrl} did not answer within ${INSTANCE_ADDRESS_TIMEOUT_MS / 1e3}s. Press Refresh to try again.`;
4123
+ }
4124
+ if (error instanceof TypeError || /failed to fetch|load failed|networkerror/i.test(raw)) {
4125
+ return `${sourceUrl} closed the connection without answering. Relays built before rootfs 0.8.0 do not serve an address document, and their proxy hangs up instead of returning 404 \u2014 redeploying from a current rootfs fixes it. (${raw})`;
4126
+ }
4127
+ return raw;
4128
+ }
4118
4129
  function emptyInstanceAddresses() {
4119
4130
  return {
4120
4131
  status: "idle",
@@ -6487,14 +6498,21 @@ var SponsorRelayController = class {
6487
6498
  sourceUrl,
6488
6499
  error: null
6489
6500
  });
6501
+ const abort = new AbortController();
6502
+ const timeout = globalThis.setTimeout(
6503
+ () => abort.abort(),
6504
+ INSTANCE_ADDRESS_TIMEOUT_MS
6505
+ );
6490
6506
  try {
6491
- const abort = new AbortController();
6492
- const timeout = globalThis.setTimeout(() => abort.abort(), 1e4);
6493
- const response = await fetch(sourceUrl, {
6494
- cache: "no-cache",
6495
- signal: abort.signal
6496
- });
6497
- globalThis.clearTimeout(timeout);
6507
+ let response;
6508
+ try {
6509
+ response = await fetch(sourceUrl, {
6510
+ cache: "no-cache",
6511
+ signal: abort.signal
6512
+ });
6513
+ } finally {
6514
+ globalThis.clearTimeout(timeout);
6515
+ }
6498
6516
  if (response.status === 404) {
6499
6517
  this.patchInstanceAddresses(instanceHash, {
6500
6518
  ...emptyInstanceAddresses(),
@@ -6521,7 +6539,7 @@ var SponsorRelayController = class {
6521
6539
  ...this.state.instanceAddresses[instanceHash] ?? emptyInstanceAddresses(),
6522
6540
  status: "error",
6523
6541
  sourceUrl,
6524
- error: error instanceof Error ? error.message : String(error)
6542
+ error: describeInstanceAddressFailure(error, sourceUrl)
6525
6543
  });
6526
6544
  }
6527
6545
  }