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