@wrongstack/webui 0.5.2 → 0.5.5
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/assets/{index-q1lcmxqy.js → index-DmGneeHU.js} +27 -27
- package/dist/index.html +1 -1
- package/dist/index.js +24 -5
- package/dist/index.js.map +1 -1
- package/dist/server/entry.js +26 -1
- package/dist/server/entry.js.map +1 -1
- package/dist/server/index.js +26 -1
- package/dist/server/index.js.map +1 -1
- package/package.json +5 -5
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-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DmGneeHU.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/vendor-Dff2jyfM.js">
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-B-u6omip.css">
|
|
11
11
|
</head>
|
package/dist/index.js
CHANGED
|
@@ -210,6 +210,26 @@ function notifyIfHidden(title, body, tag) {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
// src/lib/ws-client.ts
|
|
213
|
+
var WS_TOKEN_KEY = "ws_token";
|
|
214
|
+
function getStoredToken() {
|
|
215
|
+
try {
|
|
216
|
+
return sessionStorage.getItem(WS_TOKEN_KEY);
|
|
217
|
+
} catch {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function setStoredToken(token) {
|
|
222
|
+
try {
|
|
223
|
+
sessionStorage.setItem(WS_TOKEN_KEY, token);
|
|
224
|
+
} catch {
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function clearStoredToken() {
|
|
228
|
+
try {
|
|
229
|
+
sessionStorage.removeItem(WS_TOKEN_KEY);
|
|
230
|
+
} catch {
|
|
231
|
+
}
|
|
232
|
+
}
|
|
213
233
|
var WrongStackWebSocketClient = class {
|
|
214
234
|
ws = null;
|
|
215
235
|
url;
|
|
@@ -222,9 +242,6 @@ var WrongStackWebSocketClient = class {
|
|
|
222
242
|
messageQueue = [];
|
|
223
243
|
pendingConfirms = /* @__PURE__ */ new Map();
|
|
224
244
|
sessionId = null;
|
|
225
|
-
/** Auth token received from server in session.start payload.
|
|
226
|
-
* Used for reconnection so the client doesn't need to know the token upfront. */
|
|
227
|
-
wsToken = null;
|
|
228
245
|
/** Stored last close reason / error message so the UI can show "what
|
|
229
246
|
* went wrong" while reconnecting instead of a generic spinner. */
|
|
230
247
|
lastErrorText;
|
|
@@ -258,7 +275,8 @@ var WrongStackWebSocketClient = class {
|
|
|
258
275
|
}
|
|
259
276
|
this.setStatus({ state: "connecting" });
|
|
260
277
|
try {
|
|
261
|
-
const
|
|
278
|
+
const storedToken = getStoredToken();
|
|
279
|
+
const wsUrl = storedToken ? `${this.url}${this.url.includes("?") ? "&" : "?"}token=${storedToken}` : this.url;
|
|
262
280
|
this.ws = new WebSocket(wsUrl);
|
|
263
281
|
this.ws.binaryType = "arraybuffer";
|
|
264
282
|
const connectTimeout = setTimeout(() => {
|
|
@@ -378,7 +396,7 @@ var WrongStackWebSocketClient = class {
|
|
|
378
396
|
const payload = msg.payload;
|
|
379
397
|
this.sessionId = payload.sessionId;
|
|
380
398
|
if (payload.wsToken) {
|
|
381
|
-
|
|
399
|
+
setStoredToken(payload.wsToken);
|
|
382
400
|
}
|
|
383
401
|
}
|
|
384
402
|
this.emit(msg);
|
|
@@ -564,6 +582,7 @@ var WrongStackWebSocketClient = class {
|
|
|
564
582
|
}
|
|
565
583
|
this.ws?.close();
|
|
566
584
|
this.ws = null;
|
|
585
|
+
clearStoredToken();
|
|
567
586
|
}
|
|
568
587
|
get isConnected() {
|
|
569
588
|
return this.ws?.readyState === WebSocket.OPEN;
|