Add Comfy-Desktop.ComfyServer.ExtraLaunchArgs (#1609)

This commit is contained in:
Chenlei Hu
2024-11-19 20:44:26 -05:00
committed by GitHub
parent 81194cc7fe
commit 8906f5c26e

View File

@@ -5,6 +5,14 @@ import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil'
const electronAPI = getElectronAPI() const electronAPI = getElectronAPI()
const desktopAppVersion = await electronAPI.getElectronVersion() const desktopAppVersion = await electronAPI.getElectronVersion()
const onChangeRestartApp = (newValue: string, oldValue: string) => {
// Add a delay to allow changes to take effect before restarting.
if (oldValue !== undefined && newValue !== oldValue) {
electronAPI.restartApp('Restart ComfyUI to apply changes.', 1500)
}
}
app.registerExtension({ app.registerExtension({
name: 'Comfy.ElectronAdapter', name: 'Comfy.ElectronAdapter',
settings: [ settings: [
@@ -14,14 +22,7 @@ import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil'
name: 'Automatically check for updates', name: 'Automatically check for updates',
type: 'boolean', type: 'boolean',
defaultValue: true, defaultValue: true,
onChange(newValue, oldValue) { onChange: onChangeRestartApp
if (oldValue !== undefined && newValue !== oldValue) {
electronAPI.restartApp(
'Restart ComfyUI to apply changes.',
1500 // add delay to allow changes to take effect before restarting.
)
}
}
}, },
{ {
id: 'Comfy-Desktop.SendStatistics', id: 'Comfy-Desktop.SendStatistics',
@@ -29,14 +30,15 @@ import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil'
name: 'Send anonymous usage statistics', name: 'Send anonymous usage statistics',
type: 'boolean', type: 'boolean',
defaultValue: true, defaultValue: true,
onChange(newValue, oldValue) { onChange: onChangeRestartApp
if (oldValue !== undefined && newValue !== oldValue) { },
electronAPI.restartApp( {
'Restart ComfyUI to apply changes.', id: 'Comfy-Desktop.ComfyServer.ExtraLaunchArgs',
1500 // add delay to allow changes to take effect before restarting. category: ['Comfy-Desktop', 'ComfyUI Server'],
) name: 'Extra launch arguments passed to the ComfyUI main.py script',
} type: 'text',
} defaultValue: '',
onChange: onChangeRestartApp
} }
], ],