mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 06:19:58 +00:00
Re-enables the system notification popup for cloud distribution, allowing cloud devs to notify cloud users about new features and updates without requiring a new release. Cloud now fetches release notes from the "cloud" project (instead of "comfyui") and uses the `cloud_version` field for version comparison. Since cloud versions are git hashes rather than semver, a helper handles both formats gracefully. The "What's New" popup is enabled for cloud, while the update toast and red dot indicator remain desktop-only since cloud auto-updates and doesn't require user action. You can test this by doing `pnpm dev:cloud` and you will see a notification I added (for testing): <img width="1891" height="2077" alt="image" src="https://github.com/user-attachments/assets/6599a6dc-a3e1-406f-a22d-14262be1f258" /> Content is controlled by non-devs at cms.comfy.org. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7277-feat-Enable-system-notifications-on-cloud-2c46d73d365081bcb33cd79ec18faefe) by [Unito](https://www.unito.io)
77 lines
1.6 KiB
TypeScript
77 lines
1.6 KiB
TypeScript
import { useAsyncState } from '@vueuse/core'
|
|
import { defineStore } from 'pinia'
|
|
|
|
import { isCloud } from '@/platform/distribution/types'
|
|
import type { SystemStats } from '@/schemas/apiSchema'
|
|
import { api } from '@/scripts/api'
|
|
import { isElectron } from '@/utils/envUtil'
|
|
|
|
export const useSystemStatsStore = defineStore('systemStats', () => {
|
|
const fetchSystemStatsData = async () => {
|
|
try {
|
|
return await api.getSystemStats()
|
|
} catch (err) {
|
|
console.error('Error fetching system stats:', err)
|
|
throw err
|
|
}
|
|
}
|
|
|
|
const {
|
|
state: systemStats,
|
|
isLoading,
|
|
error,
|
|
isReady: isInitialized,
|
|
execute: refetchSystemStats
|
|
} = useAsyncState<SystemStats | null>(
|
|
fetchSystemStatsData,
|
|
null, // initial value
|
|
{
|
|
immediate: true
|
|
}
|
|
)
|
|
|
|
function getFormFactor(): string {
|
|
if (isCloud) {
|
|
return 'cloud'
|
|
}
|
|
|
|
if (!systemStats.value?.system?.os) {
|
|
return 'other'
|
|
}
|
|
|
|
const os = systemStats.value.system.os.toLowerCase()
|
|
const isDesktop = isElectron()
|
|
|
|
if (isDesktop) {
|
|
if (os.includes('windows')) {
|
|
return 'desktop-windows'
|
|
}
|
|
if (os.includes('darwin') || os.includes('mac')) {
|
|
return 'desktop-mac'
|
|
}
|
|
} else {
|
|
// Git/source installation
|
|
if (os.includes('windows')) {
|
|
return 'git-windows'
|
|
}
|
|
if (os.includes('darwin') || os.includes('mac')) {
|
|
return 'git-mac'
|
|
}
|
|
if (os.includes('linux')) {
|
|
return 'git-linux'
|
|
}
|
|
}
|
|
|
|
return 'other'
|
|
}
|
|
|
|
return {
|
|
systemStats,
|
|
isLoading,
|
|
error,
|
|
isInitialized,
|
|
refetchSystemStats,
|
|
getFormFactor
|
|
}
|
|
})
|