Implemented dev support for session status.
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

This commit is contained in:
Tom Butcher 2026-06-20 01:34:06 +01:00
parent 49dca65470
commit f50949a192
3 changed files with 18 additions and 1 deletions

View File

@ -78,7 +78,7 @@
"electron": "cross-env ELECTRON_START_URL=http://0.0.0.0:5780 && cross-env NODE_ENV=development && electron .", "electron": "cross-env ELECTRON_START_URL=http://0.0.0.0:5780 && cross-env NODE_ENV=development && electron .",
"start": "serve -s build", "start": "serve -s build",
"build": "vite 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:electron": "vite build && electron-builder",
"build:cloudflare": "cross-env VITE_DEPLOY_TARGET=cloudflare vite build", "build:cloudflare": "cross-env VITE_DEPLOY_TARGET=cloudflare vite build",
"deploy": "npm run build:cloudflare && wrangler pages deploy --branch main" "deploy": "npm run build:cloudflare && wrangler pages deploy --branch main"

View File

@ -27,6 +27,9 @@ const AuthLaunch = () => {
useEffect(() => { useEffect(() => {
let cancelled = false let cancelled = false
const redirect = new URLSearchParams(location.search).get('redirect') const redirect = new URLSearchParams(location.search).get('redirect')
const redirectType = new URLSearchParams(location.search).get(
'redirectType'
)
if (!redirect) { if (!redirect) {
setLaunchError(true) setLaunchError(true)
@ -67,6 +70,18 @@ const AuthLaunch = () => {
const link = document.createElement('a') const link = document.createElement('a')
link.href = redirectWithLaunchSession link.href = redirectWithLaunchSession
link.style.display = 'none' 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) document.body.appendChild(link)
link.click() link.click()
document.body.removeChild(link) document.body.removeChild(link)

View File

@ -1632,6 +1632,8 @@ const ApiServerProvider = ({ children }) => {
'launchSession' 'launchSession'
) )
console.log(new URLSearchParams(location.search))
if ( if (
authenticated !== true || authenticated !== true ||
!token || !token ||