[Desktop] Add toasts for update check (#3723)

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
This commit is contained in:
Benjamin Lu
2025-05-02 11:06:51 -04:00
committed by GitHub
parent 869f500d4e
commit b61640c51b
8 changed files with 62 additions and 8 deletions

View File

@@ -1,7 +1,10 @@
import log from 'loglevel'
import { PYTHON_MIRROR } from '@/constants/uvMirrors'
import { t } from '@/i18n'
import { app } from '@/scripts/app'
import { useDialogService } from '@/services/dialogService'
import { useToastStore } from '@/stores/toastStore'
import { useWorkflowStore } from '@/stores/workflowStore'
import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil'
import { checkMirrorReachable } from '@/utils/networkUtil'
@@ -12,6 +15,7 @@ import { checkMirrorReachable } from '@/utils/networkUtil'
const electronAPI = getElectronAPI()
const desktopAppVersion = await electronAPI.getElectronVersion()
const workflowStore = useWorkflowStore()
const toastStore = useToastStore()
const onChangeRestartApp = (newValue: string, oldValue: string) => {
// Add a delay to allow changes to take effect before restarting.
@@ -163,19 +167,48 @@ import { checkMirrorReachable } from '@/utils/networkUtil'
label: 'Check for Updates',
icon: 'pi pi-sync',
async function() {
const updateAvailable = await electronAPI.checkForUpdates({
disableUpdateReadyAction: true
})
if (updateAvailable.isUpdateAvailable) {
const version = updateAvailable.version
try {
const updateInfo = await electronAPI.checkForUpdates({
disableUpdateReadyAction: true
})
if (!updateInfo.isUpdateAvailable) {
toastStore.add({
severity: 'info',
summary: t('desktopUpdate.noUpdateFound'),
life: 5_000
})
return
}
const proceed = await useDialogService().confirm({
title: t('desktopUpdate.updateFoundTitle', { version }),
title: t('desktopUpdate.updateFoundTitle', {
version: updateInfo.version
}),
message: t('desktopUpdate.updateAvailableMessage'),
type: 'default'
})
if (proceed) {
electronAPI.restartAndInstall()
try {
electronAPI.restartAndInstall()
} catch (error) {
log.error('Error installing update:', error)
toastStore.add({
severity: 'error',
summary: t('g.error'),
detail: t('desktopUpdate.errorInstallingUpdate'),
life: 10_000
})
}
}
} catch (error) {
log.error('Error checking for updates:', error)
toastStore.add({
severity: 'error',
summary: t('g.error'),
detail: t('desktopUpdate.errorCheckingUpdate'),
life: 10_000
})
}
}
},

View File

@@ -1019,7 +1019,10 @@
"description": "ComfyUI Desktop is installing new dependencies. This may take a few minutes.",
"terminalDefaultMessage": "Any console output from the update will be shown here.",
"updateFoundTitle": "Update Found (v{version})",
"updateAvailableMessage": "An update is available. Do you want to restart and update now?"
"updateAvailableMessage": "An update is available. Do you want to restart and update now?",
"noUpdateFound": "No update found",
"errorCheckingUpdate": "Error checking for updates",
"errorInstallingUpdate": "Error installing update"
},
"clipboard": {
"successMessage": "Copied to clipboard",

View File

@@ -171,6 +171,9 @@
},
"desktopUpdate": {
"description": "ComfyUI Desktop está instalando nuevas dependencias. Esto puede tardar unos minutos.",
"errorCheckingUpdate": "Error al buscar actualizaciones",
"errorInstallingUpdate": "Error al instalar la actualización",
"noUpdateFound": "No se encontró ninguna actualización",
"terminalDefaultMessage": "Cualquier salida de consola de la actualización se mostrará aquí.",
"title": "Actualizando ComfyUI Desktop",
"updateAvailableMessage": "Hay una actualización disponible. ¿Quieres reiniciar y actualizar ahora?",

View File

@@ -171,6 +171,9 @@
},
"desktopUpdate": {
"description": "ComfyUI Desktop installe de nouvelles dépendances. Cela peut prendre quelques minutes.",
"errorCheckingUpdate": "Erreur lors de la vérification des mises à jour",
"errorInstallingUpdate": "Erreur lors de l'installation de la mise à jour",
"noUpdateFound": "Aucune mise à jour trouvée",
"terminalDefaultMessage": "Toute sortie de console de la mise à jour sera affichée ici.",
"title": "Mise à jour de ComfyUI Desktop",
"updateAvailableMessage": "Une mise à jour est disponible. Voulez-vous redémarrer et mettre à jour maintenant?",

View File

@@ -171,6 +171,9 @@
},
"desktopUpdate": {
"description": "ComfyUIデスクトップは新しい依存関係をインストールしています。これには数分かかる場合があります。",
"errorCheckingUpdate": "アップデートの確認中にエラーが発生しました",
"errorInstallingUpdate": "アップデートのインストール中にエラーが発生しました",
"noUpdateFound": "アップデートは見つかりませんでした",
"terminalDefaultMessage": "更新からの任意のコンソール出力はここに表示されます。",
"title": "ComfyUIデスクトップの更新",
"updateAvailableMessage": "アップデートが利用可能です。今すぐ再起動してアップデートしますか?",

View File

@@ -171,6 +171,9 @@
},
"desktopUpdate": {
"description": "ComfyUI 데스크톱이 새로운 종속성을 설치하고 있습니다. 이 작업은 몇 분 정도 걸릴 수 있습니다.",
"errorCheckingUpdate": "업데이트 확인 중 오류가 발생했습니다",
"errorInstallingUpdate": "업데이트 설치 중 오류가 발생했습니다",
"noUpdateFound": "업데이트를 찾을 수 없습니다",
"terminalDefaultMessage": "업데이트 콘솔 출력은 여기에 표시됩니다.",
"title": "ComfyUI 데스크톱 업데이트 중",
"updateAvailableMessage": "업데이트가 가능합니다. 지금 재시작하고 업데이트하시겠습니까?",

View File

@@ -171,6 +171,9 @@
},
"desktopUpdate": {
"description": "ComfyUI Desktop устанавливает новые зависимости. Это может занять несколько минут.",
"errorCheckingUpdate": "Ошибка при проверке обновлений",
"errorInstallingUpdate": "Ошибка при установке обновления",
"noUpdateFound": "Обновлений не найдено",
"terminalDefaultMessage": "Любой вывод консоли из обновления будет отображаться здесь.",
"title": "Обновление ComfyUI Desktop",
"updateAvailableMessage": "Доступно обновление. Вы хотите перезагрузить и обновить сейчас?",

View File

@@ -171,6 +171,9 @@
},
"desktopUpdate": {
"description": "ComfyUI桌面正在安装新的依赖项。这可能需要几分钟的时间。",
"errorCheckingUpdate": "检查更新时出错",
"errorInstallingUpdate": "安装更新时出错",
"noUpdateFound": "未发现更新",
"terminalDefaultMessage": "更新过程中的任何控制台输出都将在这里显示。",
"title": "正在更新ComfyUI桌面",
"updateAvailableMessage": "有可用的更新。您现在要重启并更新吗?",