@hachej/boring-core 0.1.49 → 0.1.51
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/app/front/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useSignIn,
|
|
10
10
|
useSignUp,
|
|
11
11
|
useWorkspaceRouteStatus
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-2ZTKRLVG.js";
|
|
13
13
|
import "../../chunk-HYNKZSTF.js";
|
|
14
14
|
import {
|
|
15
15
|
isRuntimeEmailVerificationEnabled
|
|
@@ -456,8 +456,51 @@ function ChatFirstPublicShell({
|
|
|
456
456
|
] });
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
+
// src/app/front/vitePreloadRecovery.ts
|
|
460
|
+
var INSTALL_FLAG = "__boringVitePreloadRecoveryInstalled__";
|
|
461
|
+
var RELOADED_ENTRY_KEY = "boring-ui:vite-preload-reloaded-entry";
|
|
462
|
+
function currentFrontendEntry(documentRef, fallback) {
|
|
463
|
+
const moduleScripts = Array.from(documentRef.scripts).filter((script) => script.type === "module" && Boolean(script.src));
|
|
464
|
+
const assetEntry = moduleScripts.find((script) => script.src.includes("/assets/"));
|
|
465
|
+
return assetEntry?.src ?? moduleScripts[0]?.src ?? fallback;
|
|
466
|
+
}
|
|
467
|
+
function shouldReloadForFrontendEntry(storage, entry) {
|
|
468
|
+
if (storage.getItem(RELOADED_ENTRY_KEY) === entry) return false;
|
|
469
|
+
storage.setItem(RELOADED_ENTRY_KEY, entry);
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
function installVitePreloadRecovery() {
|
|
473
|
+
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
474
|
+
const recoverableWindow = window;
|
|
475
|
+
if (recoverableWindow[INSTALL_FLAG]) return;
|
|
476
|
+
recoverableWindow[INSTALL_FLAG] = true;
|
|
477
|
+
window.addEventListener("vite:preloadError", (event) => {
|
|
478
|
+
event.preventDefault();
|
|
479
|
+
const entry = currentFrontendEntry(document, window.location.href);
|
|
480
|
+
let shouldReload = false;
|
|
481
|
+
try {
|
|
482
|
+
shouldReload = shouldReloadForFrontendEntry(window.sessionStorage, entry);
|
|
483
|
+
} catch {
|
|
484
|
+
shouldReload = false;
|
|
485
|
+
}
|
|
486
|
+
if (!shouldReload) {
|
|
487
|
+
console.warn(
|
|
488
|
+
"[boring-core] dynamic import failed after a reload attempt; leaving the panel error visible.",
|
|
489
|
+
event.payload
|
|
490
|
+
);
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
console.warn(
|
|
494
|
+
"[boring-core] dynamic import failed; reloading to pick up the latest app assets.",
|
|
495
|
+
event.payload
|
|
496
|
+
);
|
|
497
|
+
window.location.reload();
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
|
|
459
501
|
// src/app/front/CoreWorkspaceAgentFront.tsx
|
|
460
502
|
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
503
|
+
installVitePreloadRecovery();
|
|
461
504
|
var DEFAULT_WORKSPACE_ROUTE = "/workspace/:id";
|
|
462
505
|
var DEFAULT_WORKSPACE_ID_PARAM = "id";
|
|
463
506
|
function DefaultTopBarRight() {
|
package/dist/app/server/index.js
CHANGED
|
@@ -286,6 +286,9 @@ function contentType(filePath) {
|
|
|
286
286
|
const ext = path.extname(filePath).toLowerCase();
|
|
287
287
|
return MIME_TYPES[ext] ?? "application/octet-stream";
|
|
288
288
|
}
|
|
289
|
+
function isFrontendAssetPath(pathname) {
|
|
290
|
+
return pathname === "/assets" || pathname.startsWith("/assets/");
|
|
291
|
+
}
|
|
289
292
|
function injectCspNonceIntoHtml(html, nonce) {
|
|
290
293
|
if (!nonce) return html;
|
|
291
294
|
const metaTag = `<meta name="boring-csp-nonce" content="${nonce}" />`;
|
|
@@ -411,6 +414,7 @@ async function serveFrontendShell(request, reply, indexPath, telemetry) {
|
|
|
411
414
|
}
|
|
412
415
|
const html = await readFile(indexPath, "utf-8");
|
|
413
416
|
captureAppOpened(telemetry, request.id);
|
|
417
|
+
reply.header("cache-control", "no-store");
|
|
414
418
|
reply.type("text/html; charset=utf-8");
|
|
415
419
|
return reply.send(injectCspNonceIntoHtml(html, request.cspNonce));
|
|
416
420
|
}
|
|
@@ -498,9 +502,17 @@ async function registerFrontendFallback(app, appRoot, telemetry) {
|
|
|
498
502
|
return { error: "invalid_path" };
|
|
499
503
|
}
|
|
500
504
|
if (await pathIsFile(candidate)) {
|
|
505
|
+
if (isFrontendAssetPath(pathname)) {
|
|
506
|
+
reply.header("cache-control", "public, max-age=31536000, immutable");
|
|
507
|
+
}
|
|
501
508
|
reply.type(contentType(candidate));
|
|
502
509
|
return reply.send(createReadStream(candidate));
|
|
503
510
|
}
|
|
511
|
+
if (isFrontendAssetPath(pathname)) {
|
|
512
|
+
reply.status(404);
|
|
513
|
+
reply.header("cache-control", "no-store");
|
|
514
|
+
return { error: "asset_not_found" };
|
|
515
|
+
}
|
|
504
516
|
return serveFrontendShell(request, reply, indexPath, telemetry);
|
|
505
517
|
});
|
|
506
518
|
}
|
|
@@ -1232,16 +1232,23 @@ function getCookie(name) {
|
|
|
1232
1232
|
function deleteCookie(name) {
|
|
1233
1233
|
document.cookie = `${name}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;
|
|
1234
1234
|
}
|
|
1235
|
+
function navigateToSignIn() {
|
|
1236
|
+
if (typeof window === "undefined") return;
|
|
1237
|
+
window.history.replaceState({}, "", routes.signin);
|
|
1238
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
1239
|
+
}
|
|
1235
1240
|
function VerifyEmailPage() {
|
|
1236
1241
|
const session = useSession();
|
|
1237
1242
|
const verifyEmail = useVerifyEmail();
|
|
1238
1243
|
const sendVerificationEmail = useSendVerificationEmail();
|
|
1244
|
+
const signOut = useSignOut();
|
|
1239
1245
|
const token = typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("token") : null;
|
|
1240
1246
|
const [status, setStatus] = useState12(token ? "verifying" : "no-token");
|
|
1241
1247
|
const [inviteWarning, setInviteWarning] = useState12(null);
|
|
1242
1248
|
const [cooldown, setCooldown] = useState12(0);
|
|
1243
1249
|
const [resendEmail, setResendEmail] = useState12("");
|
|
1244
1250
|
const [resendSent, setResendSent] = useState12(false);
|
|
1251
|
+
const [isSigningOut, setIsSigningOut] = useState12(false);
|
|
1245
1252
|
const verifiedRef = useRef4(false);
|
|
1246
1253
|
const sessionEmail = session.data?.user?.email ?? null;
|
|
1247
1254
|
useEffect8(() => {
|
|
@@ -1296,6 +1303,15 @@ function VerifyEmailPage() {
|
|
|
1296
1303
|
setResendSent(true);
|
|
1297
1304
|
setCooldown(60);
|
|
1298
1305
|
}, [sessionEmail, resendEmail, cooldown, sendVerificationEmail]);
|
|
1306
|
+
const handleBackToSignIn = useCallback3(async () => {
|
|
1307
|
+
if (isSigningOut) return;
|
|
1308
|
+
setIsSigningOut(true);
|
|
1309
|
+
try {
|
|
1310
|
+
await signOut();
|
|
1311
|
+
} finally {
|
|
1312
|
+
navigateToSignIn();
|
|
1313
|
+
}
|
|
1314
|
+
}, [isSigningOut, signOut]);
|
|
1299
1315
|
const resendButton = /* @__PURE__ */ jsx12(
|
|
1300
1316
|
Button7,
|
|
1301
1317
|
{
|
|
@@ -1347,7 +1363,17 @@ function VerifyEmailPage() {
|
|
|
1347
1363
|
/* @__PURE__ */ jsx12(CardDescription5, { children: "This verification link is no longer valid. Request a new one below." })
|
|
1348
1364
|
] }),
|
|
1349
1365
|
/* @__PURE__ */ jsx12(CardContent5, { children: resendSection }),
|
|
1350
|
-
/* @__PURE__ */ jsx12(CardFooter5, { children: /* @__PURE__ */ jsx12(
|
|
1366
|
+
/* @__PURE__ */ jsx12(CardFooter5, { children: /* @__PURE__ */ jsx12(
|
|
1367
|
+
Button7,
|
|
1368
|
+
{
|
|
1369
|
+
type: "button",
|
|
1370
|
+
variant: "link",
|
|
1371
|
+
className: "h-auto p-0 text-sm text-muted-foreground hover:underline",
|
|
1372
|
+
disabled: isSigningOut,
|
|
1373
|
+
onClick: handleBackToSignIn,
|
|
1374
|
+
children: isSigningOut ? "Signing out\u2026" : "Back to sign in"
|
|
1375
|
+
}
|
|
1376
|
+
) })
|
|
1351
1377
|
] }) });
|
|
1352
1378
|
}
|
|
1353
1379
|
const isWaitingForEmailClick = status === "no-token" && Boolean(sessionEmail);
|
|
@@ -1358,7 +1384,17 @@ function VerifyEmailPage() {
|
|
|
1358
1384
|
/* @__PURE__ */ jsx12(CardDescription5, { children: isWaitingForEmailClick ? "We sent a verification link to your email address. Please check your inbox to continue." : status === "no-token" ? "No verification token found. Check the link in your email." : "This verification link is invalid. Request a new one below." })
|
|
1359
1385
|
] }),
|
|
1360
1386
|
/* @__PURE__ */ jsx12(CardContent5, { children: resendSection }),
|
|
1361
|
-
/* @__PURE__ */ jsx12(CardFooter5, { children: /* @__PURE__ */ jsx12(
|
|
1387
|
+
/* @__PURE__ */ jsx12(CardFooter5, { children: /* @__PURE__ */ jsx12(
|
|
1388
|
+
Button7,
|
|
1389
|
+
{
|
|
1390
|
+
type: "button",
|
|
1391
|
+
variant: "link",
|
|
1392
|
+
className: "h-auto p-0 text-sm text-muted-foreground hover:underline",
|
|
1393
|
+
disabled: isSigningOut,
|
|
1394
|
+
onClick: handleBackToSignIn,
|
|
1395
|
+
children: isSigningOut ? "Signing out\u2026" : "Back to sign in"
|
|
1396
|
+
}
|
|
1397
|
+
) })
|
|
1362
1398
|
] }) });
|
|
1363
1399
|
}
|
|
1364
1400
|
|
package/dist/front/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hachej/boring-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.51",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Foundation package for boring-ui-v2 apps: DB, auth, config, HTTP app factory, and frontend app shell.",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"react-router-dom": "^7.14.2",
|
|
80
80
|
"smol-toml": "^1.6.1",
|
|
81
81
|
"zod": "^3.25.76",
|
|
82
|
-
"@hachej/boring-
|
|
83
|
-
"@hachej/boring-ui-kit": "0.1.
|
|
84
|
-
"@hachej/boring-
|
|
82
|
+
"@hachej/boring-agent": "0.1.51",
|
|
83
|
+
"@hachej/boring-ui-kit": "0.1.51",
|
|
84
|
+
"@hachej/boring-workspace": "0.1.51"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@testing-library/jest-dom": "^6.9.1",
|