@wrongstack/webui 0.3.3 → 0.3.4

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/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/wrongstack.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>WrongStack WebUI</title>
8
- <script type="module" crossorigin src="/assets/index-CJmc6zwr.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-C0CgRrvX.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/vendor-Dff2jyfM.js">
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-TCwASaz8.css">
11
11
  </head>
package/dist/index.js CHANGED
@@ -212,6 +212,9 @@ var WrongStackWebSocketClient = class {
212
212
  messageQueue = [];
213
213
  pendingConfirms = /* @__PURE__ */ new Map();
214
214
  sessionId = null;
215
+ /** Auth token received from server in session.start payload.
216
+ * Used for reconnection so the client doesn't need to know the token upfront. */
217
+ wsToken = null;
215
218
  /** Stored last close reason / error message so the UI can show "what
216
219
  * went wrong" while reconnecting instead of a generic spinner. */
217
220
  lastErrorText;
@@ -245,7 +248,8 @@ var WrongStackWebSocketClient = class {
245
248
  }
246
249
  this.setStatus({ state: "connecting" });
247
250
  try {
248
- this.ws = new WebSocket(this.url);
251
+ const wsUrl = this.wsToken ? `${this.url}${this.url.includes("?") ? "&" : "?"}token=${this.wsToken}` : this.url;
252
+ this.ws = new WebSocket(wsUrl);
249
253
  this.ws.binaryType = "arraybuffer";
250
254
  const connectTimeout = setTimeout(() => {
251
255
  reject(new Error("Connection timeout"));
@@ -363,6 +367,9 @@ var WrongStackWebSocketClient = class {
363
367
  if (msg.type === "session.start") {
364
368
  const payload = msg.payload;
365
369
  this.sessionId = payload.sessionId;
370
+ if (payload.wsToken) {
371
+ this.wsToken = payload.wsToken;
372
+ }
366
373
  }
367
374
  this.emit(msg);
368
375
  }