@lifeaitools/clauth 1.4.8 → 1.4.9

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.
@@ -1217,8 +1217,25 @@ async function loadServices() {
1217
1217
  err.style.display = "none";
1218
1218
  grid.innerHTML = '<p class="loading">Loading…</p>';
1219
1219
 
1220
+ let status;
1221
+ for (let attempt = 0; attempt < 3; attempt++) {
1222
+ try {
1223
+ status = await Promise.race([
1224
+ fetch(BASE + "/status").then(r => r.json()),
1225
+ new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 8000))
1226
+ ]);
1227
+ break;
1228
+ } catch (e) {
1229
+ if (attempt === 2) {
1230
+ err.textContent = "⚠ Could not load services — " + e.message;
1231
+ err.style.display = "block";
1232
+ grid.innerHTML = "";
1233
+ return;
1234
+ }
1235
+ await new Promise(r => setTimeout(r, 1000));
1236
+ }
1237
+ }
1220
1238
  try {
1221
- const status = await fetch(BASE + "/status").then(r => r.json());
1222
1239
  if (status.locked) { showLockScreen(); return; }
1223
1240
  if (status.error) throw new Error(status.error);
1224
1241
 
@@ -1758,8 +1775,16 @@ let tunnelPollTimer = null;
1758
1775
 
1759
1776
  async function pollTunnel() {
1760
1777
  if (tunnelPollTimer) clearInterval(tunnelPollTimer);
1778
+ // Give server 4s grace to run fetchTunnelConfig before showing "not_started" UI
1761
1779
  const r = await apiFetch("/tunnel");
1762
- if (r) renderTunnelPanel(r.status, r.url, r.error);
1780
+ if (r && r.status !== "not_started") {
1781
+ renderTunnelPanel(r.status, r.url, r.error);
1782
+ } else {
1783
+ renderTunnelPanel("starting", null, null); // show spinner while server initialises
1784
+ await new Promise(res => setTimeout(res, 4000));
1785
+ const r2 = await apiFetch("/tunnel");
1786
+ if (r2) renderTunnelPanel(r2.status, r2.url, r2.error);
1787
+ }
1763
1788
  // Poll every 3s; slow to 10s once live
1764
1789
  tunnelPollTimer = setInterval(async () => {
1765
1790
  const r = await apiFetch("/tunnel");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/clauth",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
5
5
  "type": "module",
6
6
  "bin": {