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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: preserve hosted join fragment credentials (#5499)
[._.]/ Adam Eivyecc66b28b6c6
diff --git a/client/src/App.jsx b/client/src/App.jsxindex 3909800ef3..26a3bbc2ee 100644--- a/client/src/App.jsx+++ b/client/src/App.jsx@@ -244,7 +244,7 @@ function useDocumentTitle(enabled = true) {export default function App() {const { pathname } = useLocation();- const isHostedAudienceRoute = pathname === '/fableloom/join';+ const isHostedAudienceRoute = pathname.replace(/\/+$/, '') === '/fableloom/join';useTimezoneBootstrap(!isHostedAudienceRoute);useDocumentTitle(!isHostedAudienceRoute);diff --git a/client/src/main.jsx b/client/src/main.jsxindex c68795ce31..edd843f65a 100644--- a/client/src/main.jsx+++ b/client/src/main.jsx@@ -86,7 +86,7 @@ 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 isHostedAudienceRoute = window.location.pathname.replace(/\/+$/, '') === '/fableloom/join';const app = isHostedAudienceRoute? <RouterProvider router={router} />: (diff --git a/client/src/services/socket.js b/client/src/services/socket.jsindex dfc8739106..9f53393e52 100644--- a/client/src/services/socket.js+++ b/client/src/services/socket.js@@ -6,10 +6,12 @@ import toast from '../components/ui/Toast';// Connect to Socket.IO using relative path (works with Tailscale)// The connection will use the same host the page was loaded from+const isHostedAudienceRoute = typeof window !== 'undefined' &&+ window.location.pathname.replace(/\/+$/, '') === '/fableloom/join';const socket = io({path: '/socket.io',transports: ['websocket', 'polling'],- autoConnect: true,+ autoConnect: !isHostedAudienceRoute,reconnection: true,reconnectionAttempts: 10,reconnectionDelay: 1000@@ -27,7 +29,7 @@ socket.on('connect_error', (err) => {// Auth gate rejected the handshake (server: services/authGate.js socketAuthGate).// Bounce to /login so the user can sign back in; skip if already there.if (err?.data?.code === 'AUTH_REQUIRED' && typeof window !== 'undefined') {- if (!window.location.pathname.startsWith('/login')) {+ if (!window.location.pathname.startsWith('/login') && !isHostedAudienceRoute) {const next = encodeURIComponent(window.location.pathname + window.location.search);window.location.replace(`/login?next=${next}`);}diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.jsindex 907183dd4a..e48b5aae27 100644--- a/server/lib/navManifest.test.js+++ b/server/lib/navManifest.test.js@@ -416,6 +416,8 @@ describe('getNavAliasMap — voice-agent compatibility', () => {// a second test fails if an opt-out entry goes stale (route deleted, or the path// gained a manifest entry) so the allow-list can't quietly rot.const APP_JSX = path.join(REPO_ROOT, 'client/src/App.jsx');+const MAIN_JSX = path.join(REPO_ROOT, 'client/src/main.jsx');+const SOCKET_JS = path.join(REPO_ROOT, 'client/src/services/socket.js');// Concrete leaf routes that render a real page but are deliberately absent from// the nav manifest — reached via an in-page button or as a create-mode sentinel,@@ -559,6 +561,19 @@ describe('nav coverage — every navigable App.jsx route has a manifest entry',expect(scan.topLevel).toContain('/fableloom/join');});+ it('keeps hosted audience joins free of authenticated app bootstraps', () => {+ // A password-gated install must not redirect a QR audience device before+ // the fragment token reaches FableLoomHostedJoin (#5499).+ const appSrc = fs.readFileSync(APP_JSX, 'utf8');+ const mainSrc = fs.readFileSync(MAIN_JSX, 'utf8');+ const socketSrc = fs.readFileSync(SOCKET_JS, 'utf8');+ expect(appSrc).toMatch(/useTimezoneBootstrap\(!isHostedAudienceRoute\)/);+ expect(appSrc).toMatch(/useDocumentTitle\(!isHostedAudienceRoute\)/);+ expect(appSrc).toMatch(/isHostedAudienceRoute\s*\?\s*routeContent/);+ expect(mainSrc).toContain("const isHostedAudienceRoute = window.location.pathname.replace(/\\/+$/, '')");+ expect(socketSrc).toMatch(/autoConnect: !isHostedAudienceRoute/);+ });+// Every page that has ever moved leaves its old path behind in bookmarks, in// stale ⌘K history, and in links other installs' peers may hold. A move that// forgets the redirect 404s all of them, and nothing else in this file would