From 242f641a1d65110a865888a74cf18ac383a0dc37 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Sat, 9 Nov 2024 12:12:51 -0500 Subject: [PATCH 01/10] WIP --- src/views/ServerStartView.vue | 56 ++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/src/views/ServerStartView.vue b/src/views/ServerStartView.vue index c35fbf0941..a6d2fd9bec 100644 --- a/src/views/ServerStartView.vue +++ b/src/views/ServerStartView.vue @@ -1,17 +1,57 @@ - - From 38307eda7168b7d49b5dbd9f3939044c7f89341c Mon Sep 17 00:00:00 2001 From: huchenlei Date: Sat, 9 Nov 2024 12:15:05 -0500 Subject: [PATCH 02/10] Add LogTerminal --- src/components/common/LogTerminal.vue | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/components/common/LogTerminal.vue diff --git a/src/components/common/LogTerminal.vue b/src/components/common/LogTerminal.vue new file mode 100644 index 0000000000..60ef2860b6 --- /dev/null +++ b/src/components/common/LogTerminal.vue @@ -0,0 +1,66 @@ + + + + From 682ec1eff88986e3573fc4e3a11ac3fbed3f2a1b Mon Sep 17 00:00:00 2001 From: huchenlei Date: Sat, 9 Nov 2024 12:23:26 -0500 Subject: [PATCH 03/10] Modify server startup view --- src/views/ServerStartView.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/views/ServerStartView.vue b/src/views/ServerStartView.vue index a6d2fd9bec..33e1c2faf3 100644 --- a/src/views/ServerStartView.vue +++ b/src/views/ServerStartView.vue @@ -7,15 +7,21 @@ :initial-path="defaultInstallLocation" @complete="showSetup = false" /> - +
+

{{ ProgressMessages[status] }}

+ +
diff --git a/src/router.ts b/src/router.ts index dd69f09539..bed4ad5faf 100644 --- a/src/router.ts +++ b/src/router.ts @@ -24,6 +24,21 @@ const router = createRouter({ path: 'server-start', name: 'ServerStartView', component: () => import('@/views/ServerStartView.vue'), + beforeEnter: async (to, from, next) => { + // Only allow access to this page in electron environment + if (isElectron()) { + next() + } else { + // TODO: Get from electronAPI + const isFirstTimeInstall = true + next(isFirstTimeInstall ? '/install' : '/') + } + } + }, + { + path: 'install', + name: 'InstallView', + component: () => import('@/views/InstallView.vue'), beforeEnter: async (to, from, next) => { // Only allow access to this page in electron environment if (isElectron()) { diff --git a/src/views/InstallView.vue b/src/views/InstallView.vue new file mode 100644 index 0000000000..922325ddc5 --- /dev/null +++ b/src/views/InstallView.vue @@ -0,0 +1,7 @@ + + + From 6340fc0b6607a9a2265b96639456a51bc2a8d513 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Sat, 9 Nov 2024 22:26:51 -0500 Subject: [PATCH 05/10] Add basic welcome screen and dev server setup --- package-lock.json | 9 +++---- package.json | 3 ++- src/components/install/WelcomeScreen.vue | 13 ++++++---- src/router.ts | 6 ++--- src/scripts/ui.ts | 1 + src/views/InstallView.vue | 6 ++++- src/views/ServerStartView.vue | 4 --- vite.electron.config.mts | 33 ++++++++++++++++++++++++ 8 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 vite.electron.config.mts diff --git a/package-lock.json b/package-lock.json index 6ebc48a217..f4e1a06409 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.3.38", "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.3.1", + "@comfyorg/comfyui-electron-types": "^0.2.10", "@comfyorg/litegraph": "^0.8.24", "@primevue/themes": "^4.0.5", "@vueuse/core": "^11.0.0", @@ -32,7 +33,6 @@ "devDependencies": { "@babel/core": "^7.24.7", "@babel/preset-env": "^7.22.20", - "@comfyorg/comfyui-electron-types": "^0.2.9", "@eslint/js": "^9.8.0", "@iconify/json": "^2.2.245", "@pinia/testing": "^0.1.5", @@ -1916,10 +1916,9 @@ "dev": true }, "node_modules/@comfyorg/comfyui-electron-types": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/@comfyorg/comfyui-electron-types/-/comfyui-electron-types-0.2.9.tgz", - "integrity": "sha512-wXmeGrQnuiEXlUkWDAnfkPgb8YTICX8EsNKSIWDb5uMSx46fW8gJQjTc1ehawV/fw1MmuqjhOpw+rV1f2+DAtw==", - "dev": true, + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/@comfyorg/comfyui-electron-types/-/comfyui-electron-types-0.2.10.tgz", + "integrity": "sha512-JwqFeqmJBp6n276Ki+VEkMkO43rFHobdt93AzJYpWC+BXGUuvTyquon/MvblWtJDnTdO0mGWGXztDFe0sXie6A==", "license": "GPL-3.0-only" }, "node_modules/@comfyorg/litegraph": { diff --git a/package.json b/package.json index ad3b463adc..b1b11e4cf5 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "type": "module", "scripts": { "dev": "vite", + "dev:electron": "vite --config vite.electron.config.mts", "build": "npm run typecheck && vite build", "deploy": "npm run build && node scripts/deploy.js", "release": "node scripts/release.js", @@ -26,7 +27,6 @@ "devDependencies": { "@babel/core": "^7.24.7", "@babel/preset-env": "^7.22.20", - "@comfyorg/comfyui-electron-types": "^0.2.9", "@eslint/js": "^9.8.0", "@iconify/json": "^2.2.245", "@pinia/testing": "^0.1.5", @@ -71,6 +71,7 @@ }, "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.3.1", + "@comfyorg/comfyui-electron-types": "^0.2.10", "@comfyorg/litegraph": "^0.8.24", "@primevue/themes": "^4.0.5", "@vueuse/core": "^11.0.0", diff --git a/src/components/install/WelcomeScreen.vue b/src/components/install/WelcomeScreen.vue index 60855d9063..08a0f637d3 100644 --- a/src/components/install/WelcomeScreen.vue +++ b/src/components/install/WelcomeScreen.vue @@ -21,19 +21,22 @@ diff --git a/vite.electron.config.mts b/vite.electron.config.mts new file mode 100644 index 0000000000..f8a64dc292 --- /dev/null +++ b/vite.electron.config.mts @@ -0,0 +1,33 @@ +import { defineConfig, Plugin } from 'vite' +import { mergeConfig } from 'vite' +import type { UserConfig } from 'vitest/config' +import baseConfig from './vite.config.mts' +import type { ElectronAPI } from '@comfyorg/comfyui-electron-types' + +const electronAPIMock: Partial = { + sendReady: () => {}, + onShowSelectDirectory: () => {}, + onFirstTimeSetupComplete: () => {}, + onProgressUpdate: () => {}, + onLogMessage: () => {}, + isFirstTimeSetup: () => Promise.resolve(true) +} + +const mockElectronAPI: Plugin = { + name: 'mock-electron-api', + transformIndexHtml() { + return [ + { + tag: 'script', + children: `window.electronAPI = ${JSON.stringify(electronAPIMock)};` + } + ] + } +} + +export default mergeConfig( + baseConfig as unknown as UserConfig, + defineConfig({ + plugins: [mockElectronAPI] + }) +) \ No newline at end of file From f1395e72f669d218ace61857099ecfa4c850d62e Mon Sep 17 00:00:00 2001 From: huchenlei Date: Sat, 9 Nov 2024 22:30:08 -0500 Subject: [PATCH 06/10] nit --- src/views/ServerStartView.vue | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/views/ServerStartView.vue b/src/views/ServerStartView.vue index abbacef3bc..81fac0a720 100644 --- a/src/views/ServerStartView.vue +++ b/src/views/ServerStartView.vue @@ -1,22 +1,14 @@