From f50949a192fdd9ebb09123490a08ca0f98088e9b Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sat, 20 Jun 2026 01:34:06 +0100 Subject: [PATCH] Implemented dev support for session status. --- package.json | 2 +- src/components/App/AppLaunch.jsx | 15 +++++++++++++++ .../Dashboard/context/ApiServerContext.jsx | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 68544fd..8941638 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "electron": "cross-env ELECTRON_START_URL=http://0.0.0.0:5780 && cross-env NODE_ENV=development && electron .", "start": "serve -s build", "build": "vite build", - "dev:electron": "concurrently \"cross-env NODE_ENV=development vite --no-open\" \"cross-env ELECTRON_START_URL=http://localhost:5780 cross-env NODE_ENV=development electron public/electron.js\"", + "dev:electron": "concurrently \"cross-env NODE_ENV=development vite --port 5780 --no-open\" \"cross-env ELECTRON_START_URL=http://localhost:5780 cross-env NODE_ENV=development electron public/electron.js\"", "build:electron": "vite build && electron-builder", "build:cloudflare": "cross-env VITE_DEPLOY_TARGET=cloudflare vite build", "deploy": "npm run build:cloudflare && wrangler pages deploy --branch main" diff --git a/src/components/App/AppLaunch.jsx b/src/components/App/AppLaunch.jsx index e587b63..c95b0a3 100644 --- a/src/components/App/AppLaunch.jsx +++ b/src/components/App/AppLaunch.jsx @@ -27,6 +27,9 @@ const AuthLaunch = () => { useEffect(() => { let cancelled = false const redirect = new URLSearchParams(location.search).get('redirect') + const redirectType = new URLSearchParams(location.search).get( + 'redirectType' + ) if (!redirect) { setLaunchError(true) @@ -67,6 +70,18 @@ const AuthLaunch = () => { const link = document.createElement('a') link.href = redirectWithLaunchSession link.style.display = 'none' + + if (redirectType === 'app-localhost') { + link.addEventListener('click', (event) => { + event.preventDefault() + window.open( + redirectWithLaunchSession, + 'farmcontrol-launch', + 'width=480,height=640,menubar=no,toolbar=no,location=yes,status=no,resizable=yes,scrollbars=yes' + ) + }) + } + document.body.appendChild(link) link.click() document.body.removeChild(link) diff --git a/src/components/Dashboard/context/ApiServerContext.jsx b/src/components/Dashboard/context/ApiServerContext.jsx index aa55363..f4d5ab9 100644 --- a/src/components/Dashboard/context/ApiServerContext.jsx +++ b/src/components/Dashboard/context/ApiServerContext.jsx @@ -1632,6 +1632,8 @@ const ApiServerProvider = ({ children }) => { 'launchSession' ) + console.log(new URLSearchParams(location.search)) + if ( authenticated !== true || !token ||