Implemented dev support for session status.
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
This commit is contained in:
parent
49dca65470
commit
f50949a192
@ -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"
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -1632,6 +1632,8 @@ const ApiServerProvider = ({ children }) => {
|
||||
'launchSession'
|
||||
)
|
||||
|
||||
console.log(new URLSearchParams(location.search))
|
||||
|
||||
if (
|
||||
authenticated !== true ||
|
||||
!token ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user