Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: protect hosted join guest bootstrap (#5499)

[._.]/ Adam Eivy420f186d9f10
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 91b313ed6c..3909800ef3 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -217,34 +217,38 @@ if (import.meta.hot) {
// date-scoped features (daily log, schedulers) land on the wrong day. Push
// the browser's IANA zone once so remote/VPN clients don't need to visit
// Settings before their first entry is correct.
-function useTimezoneBootstrap() {
+function useTimezoneBootstrap(enabled = true) {
useEffect(() => {
+ if (!enabled) return;
getSettings().then((s) => {
if (s?.timezone) return;
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
if (!tz || tz === 'UTC') return;
return updateSettings({ timezone: tz });
}).catch(() => null);
- }, []);
+ }, [enabled]);
}
// Stamp the machine's instance name into the browser tab so multiple federated
// installs are distinguishable at a glance — "PortOS: {name}". Falls back to the
// static "PortOS" title (set in index.html) when the name is missing/unfetchable.
-function useDocumentTitle() {
+function useDocumentTitle(enabled = true) {
useEffect(() => {
+ if (!enabled) return;
getSelfInstance({ silent: true }).then((self) => {
const name = self?.name?.trim();
if (name) document.title = `PortOS: ${name}`;
}).catch(() => null);
- }, []);
+ }, [enabled]);
}
export default function App() {
- useTimezoneBootstrap();
- useDocumentTitle();
- return (
- <CatalogTypesProvider>
+ const { pathname } = useLocation();
+ const isHostedAudienceRoute = pathname === '/fableloom/join';
+ useTimezoneBootstrap(!isHostedAudienceRoute);
+ useDocumentTitle(!isHostedAudienceRoute);
+
+ const routeContent = (
<Suspense fallback={<PageLoader />}>
<Routes>
<Route path="/login" element={<Login />} />
@@ -566,6 +570,8 @@ export default function App() {
</Route>
</Routes>
</Suspense>
- </CatalogTypesProvider>
);
+ return isHostedAudienceRoute
+ ? routeContent
+ : <CatalogTypesProvider>{routeContent}</CatalogTypesProvider>;
}
diff --git a/client/src/main.jsx b/client/src/main.jsx
index deb1558d6a..c68795ce31 100644
--- a/client/src/main.jsx
+++ b/client/src/main.jsx
@@ -83,12 +83,22 @@ const router = createBrowserRouter([
},
]);
+// The QR audience route is intentionally a no-bootstrap guest surface. Avoid
+// the theme settings request on a password-gated install: its 401 redirect
+// would otherwise replace the URL and discard the fragment credentials.
+const isHostedAudienceRoute = window.location.pathname === '/fableloom/join';
+const app = isHostedAudienceRoute
+ ? <RouterProvider router={router} />
+ : (
+ <ThemeProvider>
+ <RouterProvider router={router} />
+ </ThemeProvider>
+ );
+
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<ErrorBoundary>
- <ThemeProvider>
- <RouterProvider router={router} />
- </ThemeProvider>
+ {app}
</ErrorBoundary>
</React.StrictMode>
);
diff --git a/client/src/pages/FableLoomHostedJoin.jsx b/client/src/pages/FableLoomHostedJoin.jsx
index 14387e6553..1e1e5eefd0 100644
--- a/client/src/pages/FableLoomHostedJoin.jsx
+++ b/client/src/pages/FableLoomHostedJoin.jsx
@@ -231,7 +231,7 @@ export default function FableLoomHostedJoin() {
{/* Transcript Stream */}
<div
ref={transcriptScrollRef}
- className="flex-1 min-h-0 p-4 overflow-y-auto space-y-3 font-sans text-sm"
+ className="flex-1 min-h-[8rem] p-4 overflow-y-auto space-y-3 font-sans text-sm"
>
{transcript.length === 0 ? (
<div className="h-full flex flex-col items-center justify-center text-center text-slate-500 text-xs py-12">
diff --git a/client/src/pages/FableLoomHostedJoin.test.jsx b/client/src/pages/FableLoomHostedJoin.test.jsx
index 71a1d25a08..4ceee3953d 100644
--- a/client/src/pages/FableLoomHostedJoin.test.jsx
+++ b/client/src/pages/FableLoomHostedJoin.test.jsx
@@ -56,9 +56,10 @@ describe('FableLoomHostedJoin', () => {
const scrollRegions = shell.querySelectorAll('.overflow-y-auto');
expect(scrollRegions).toHaveLength(1);
- expect(scrollRegions[0]).toHaveClass('flex-1', 'min-h-0');
- expect(screen.getByRole('banner')).toHaveClass('shrink-0');
- expect(screen.getByRole('banner').nextElementSibling).toHaveClass('shrink-0');
+ expect(scrollRegions[0]).toHaveClass('flex-1', 'min-h-[8rem]');
+ const header = shell.querySelector('header');
+ expect(header).toHaveClass('shrink-0');
+ expect(header.nextElementSibling).toHaveClass('shrink-0');
expect(screen.getByPlaceholderText('Or type a message…').closest('form').parentElement).toHaveClass('shrink-0');
});