shadok-ai 0.16.33 → 0.17.0

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/README.md CHANGED
@@ -453,6 +453,9 @@ know before opening it up:
453
453
  else you do. Accounts belong to **one instance** (one launch directory), like
454
454
  its channels and its scheduled prompts. With no password there are no
455
455
  accounts and no login screen — nothing changes for a machine you use alone.
456
+ When a signed-in session **expires** (the cookie lasts a week), the open tab
457
+ returns you to the login screen on its next request instead of failing in
458
+ place — a paste that would not send, an agent list that would not refresh.
456
459
  - **Two-factor sign-in (passkeys).** From the **Users** panel, anyone signed in
457
460
  with a named account can register a passkey on their device — the
458
461
  fingerprint / face / PIN unlock of the phone or laptop (WebAuthn, user
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadok-ai",
3
- "version": "0.16.33",
3
+ "version": "0.17.0",
4
4
  "main": "dist/session.js",
5
5
  "scripts": {
6
6
  "test": "node --import tsx --test --test-timeout=120000 test/*.ts context/*/test/*.test.mjs",
package/public/index.html CHANGED
@@ -2540,6 +2540,33 @@
2540
2540
  flash of the dark default. Nonce'd like every inline script (invariant 12). -->
2541
2541
  <script nonce="__CSP_NONCE__">
2542
2542
  try { if (localStorage.getItem("cp.mode") === "light") document.documentElement.setAttribute("data-mode", "light"); } catch (e) {}
2543
+ // When the cockpit's OWN session expires mid-use (the account cookie lapses —
2544
+ // a week by default — or the GUI password changes under us), the server starts
2545
+ // answering every request 401 and refuses the WebSocket upgrade. The page used
2546
+ // to just fail quietly: a paste "not sent", the agent list frozen, the socket
2547
+ // looping "reconnecting", with nothing saying you are logged out (the admin hit
2548
+ // exactly this and read it as a file bug). A 401 here can ONLY mean logged out:
2549
+ // authorization failures (a member hitting an admin route) are 403, and a tab
2550
+ // that loads while already logged out never reaches this page — the gate serves
2551
+ // the login screen for a text/html GET. So the first 401 any fetch sees sends
2552
+ // us back to the login screen, which a plain reload of "/" renders (that same
2553
+ // gate). Installed in the first inline script, before any boot fetch runs, so
2554
+ // even the opening /defaults and /channels are covered. A half-typed prompt is
2555
+ // already saved to localStorage on input, so the reload loses nothing; the
2556
+ // cockpit restores it once you sign back in.
2557
+ (function () {
2558
+ var goneToLogin = false;
2559
+ var nativeFetch = window.fetch.bind(window);
2560
+ window.fetch = function () {
2561
+ return nativeFetch.apply(null, arguments).then(function (res) {
2562
+ if (res && res.status === 401 && !goneToLogin) {
2563
+ goneToLogin = true;
2564
+ location.reload();
2565
+ }
2566
+ return res;
2567
+ });
2568
+ };
2569
+ })();
2543
2570
  </script>
2544
2571
  </head>
2545
2572
  <body>