allow installed AppImage apps to launch without URL
This commit is contained in:
+6
-5
@@ -760,7 +760,7 @@ function createWindow(): void {
|
|||||||
|
|
||||||
ipcMain.on('launch-app', (_, payload: {
|
ipcMain.on('launch-app', (_, payload: {
|
||||||
appName: string
|
appName: string
|
||||||
url: string
|
url?: string
|
||||||
width?: number
|
width?: number
|
||||||
height?: number
|
height?: number
|
||||||
devAppPath?: string
|
devAppPath?: string
|
||||||
@@ -815,17 +815,18 @@ function createWindow(): void {
|
|||||||
: resolvedExecPath
|
: resolvedExecPath
|
||||||
if (spawnPath) {
|
if (spawnPath) {
|
||||||
const useDevLauncher = is.dev && spawnPath === resolvedDevAppPath
|
const useDevLauncher = is.dev && spawnPath === resolvedDevAppPath
|
||||||
|
const launchUrlArg = url ? [`--url=${encodeURIComponent(url)}`] : []
|
||||||
const args = useDevLauncher
|
const args = useDevLauncher
|
||||||
? ['run', 'dev']
|
? ['run', 'dev']
|
||||||
: [`--url=${encodeURIComponent(url)}`, ...authLaunchArgs, ...(authProtocolUrl ? [authProtocolUrl] : [])]
|
: [...launchUrlArg, ...authLaunchArgs, ...(authProtocolUrl ? [authProtocolUrl] : [])]
|
||||||
const execBin = useDevLauncher ? 'npm' : spawnPath
|
const execBin = useDevLauncher ? 'npm' : spawnPath
|
||||||
|
|
||||||
const childEnv = { ...process.env }
|
const childEnv = { ...process.env }
|
||||||
if (useDevLauncher) {
|
if (useDevLauncher && url) {
|
||||||
childEnv.ATNMY_APP_URL = url
|
childEnv.ATNMY_APP_URL = url
|
||||||
}
|
}
|
||||||
if (useDevLauncher && handoffCode) {
|
if (useDevLauncher && handoffCode) {
|
||||||
childEnv.ATNMY_HANDOFF_FILE = writeDevHandoffFile(appName, url, handoffCode, audienceApp)
|
childEnv.ATNMY_HANDOFF_FILE = writeDevHandoffFile(appName, url ?? '', handoffCode, audienceApp)
|
||||||
childEnv.ATNMY_HANDOFF_TOKEN = handoffCode
|
childEnv.ATNMY_HANDOFF_TOKEN = handoffCode
|
||||||
childEnv.ATNMY_AUDIENCE_APP = audienceApp
|
childEnv.ATNMY_AUDIENCE_APP = audienceApp
|
||||||
} else if (handoffCode) {
|
} else if (handoffCode) {
|
||||||
@@ -885,7 +886,7 @@ function createWindow(): void {
|
|||||||
additionalArguments: [
|
additionalArguments: [
|
||||||
'--app-window',
|
'--app-window',
|
||||||
`--app-name=${encodeURIComponent(appName)}`,
|
`--app-name=${encodeURIComponent(appName)}`,
|
||||||
`--app-url=${encodeURIComponent(url)}`
|
`--app-url=${encodeURIComponent(url ?? '')}`
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -94,7 +94,9 @@ function Dashboard({ authSession, onSessionUpdate, onLogout }: DashboardProps):
|
|||||||
const activeLocalVersion = localVersions[activeApp]
|
const activeLocalVersion = localVersions[activeApp]
|
||||||
const appAction = appStatus?.action ?? 'UNAVAILABLE'
|
const appAction = appStatus?.action ?? 'UNAVAILABLE'
|
||||||
const hasAppPermission = appConfig !== null && appConfig.canLaunch !== false && appStatus?.canLaunch !== false
|
const hasAppPermission = appConfig !== null && appConfig.canLaunch !== false && appStatus?.canLaunch !== false
|
||||||
const canLaunch = hasAppPermission && appAction === 'LAUNCH' && Boolean(appConfig?.launchUrl)
|
const canLaunch = hasAppPermission
|
||||||
|
&& appAction === 'LAUNCH'
|
||||||
|
&& Boolean(appConfig?.launchUrl || appConfig?.execPath || appStatus?.installed)
|
||||||
const hasAnyUpdatingApp = Object.values(updatingApps).some(Boolean)
|
const hasAnyUpdatingApp = Object.values(updatingApps).some(Boolean)
|
||||||
const activeAppUpdating = Boolean(updatingApps[activeApp])
|
const activeAppUpdating = Boolean(updatingApps[activeApp])
|
||||||
const activeAppLaunching = launchingApp === activeApp
|
const activeAppLaunching = launchingApp === activeApp
|
||||||
|
|||||||
Reference in New Issue
Block a user