From 36c26046397f18a6fcd99600aad1eb0750ed5bf7 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 4 Dec 2024 19:34:55 -0800 Subject: [PATCH] [Electron] Use electronAPI to get ComfyUI core version (#1804) --- package-lock.json | 8 ++++---- package.json | 2 +- src/stores/aboutPanelStore.ts | 9 ++++++++- vite.electron.config.mts | 3 ++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8e28c89b5..b646c6b3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "GPL-3.0-only", "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.3.1", - "@comfyorg/comfyui-electron-types": "^0.3.19", + "@comfyorg/comfyui-electron-types": "^0.3.25", "@comfyorg/litegraph": "^0.8.42", "@primevue/themes": "^4.0.5", "@vueuse/core": "^11.0.0", @@ -1951,9 +1951,9 @@ "dev": true }, "node_modules/@comfyorg/comfyui-electron-types": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/@comfyorg/comfyui-electron-types/-/comfyui-electron-types-0.3.19.tgz", - "integrity": "sha512-VNr542eaLVmaeSJIvGv/Y5OiC2vYiLy+FtjwYtP+J8M5BSy88GCikX2K9NIkLPtcw9DLolVK3XWuIvFpsOK0zg==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@comfyorg/comfyui-electron-types/-/comfyui-electron-types-0.3.25.tgz", + "integrity": "sha512-DKZJ5qXJG3dn3bmdJShm/a893cPm2OzJPxI62J/9ED8OTRmKEN3CVNX3Ire7Nj4g+GRLDZHnKVo/GYSXXOtufA==", "license": "GPL-3.0-only" }, "node_modules/@comfyorg/litegraph": { diff --git a/package.json b/package.json index 94151b055..5af79f53c 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ }, "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.3.1", - "@comfyorg/comfyui-electron-types": "^0.3.19", + "@comfyorg/comfyui-electron-types": "^0.3.25", "@comfyorg/litegraph": "^0.8.42", "@primevue/themes": "^4.0.5", "@vueuse/core": "^11.0.0", diff --git a/src/stores/aboutPanelStore.ts b/src/stores/aboutPanelStore.ts index 9bf591924..82658320f 100644 --- a/src/stores/aboutPanelStore.ts +++ b/src/stores/aboutPanelStore.ts @@ -3,6 +3,7 @@ import { defineStore } from 'pinia' import { computed } from 'vue' import { useSystemStatsStore } from './systemStatsStore' import { useExtensionStore } from './extensionStore' +import { electronAPI, isElectron } from '@/utils/envUtil' export const useAboutPanelStore = defineStore('aboutPanel', () => { const frontendVersion = __COMFYUI_FRONTEND_VERSION__ @@ -13,8 +14,14 @@ export const useAboutPanelStore = defineStore('aboutPanel', () => { ) const coreBadges = computed(() => [ + // In electron, the ComfyUI is packaged without the git repo, + // so the python server's API doesn't have the version info. { - label: `ComfyUI ${coreVersion.value}`, + label: `ComfyUI ${ + isElectron() + ? 'v' + electronAPI().getComfyUIVersion() + : coreVersion.value + }`, url: 'https://github.com/comfyanonymous/ComfyUI', icon: 'pi pi-github' }, diff --git a/vite.electron.config.mts b/vite.electron.config.mts index 20ce80859..5b767af27 100644 --- a/vite.electron.config.mts +++ b/vite.electron.config.mts @@ -50,7 +50,8 @@ const mockElectronAPI: Plugin = { getAllDownloads: () => Promise.resolve([]), onDownloadProgress: () => {} }, - getElectronVersion: () => Promise.resolve('1.0.0') + getElectronVersion: () => Promise.resolve('1.0.0'), + getComfyUIVersion: () => '9.9.9' };` } ]