feat: Enable system notifications on cloud (#7277)

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)
This commit is contained in:
Christian Byrne
2025-12-09 01:32:13 -08:00
committed by GitHub
parent 82fc96155f
commit 4d3f918e8e
4 changed files with 63 additions and 40 deletions

View File

@@ -1,6 +1,6 @@
import { until } from '@vueuse/core'
import { defineStore } from 'pinia'
import { compare } from 'semver'
import { compare, valid } from 'semver'
import { computed, ref } from 'vue'
import { isCloud } from '@/platform/distribution/types'
@@ -24,10 +24,12 @@ export const useReleaseStore = defineStore('release', () => {
const systemStatsStore = useSystemStatsStore()
const settingStore = useSettingStore()
// Current ComfyUI version
const currentComfyUIVersion = computed(
() => systemStatsStore?.systemStats?.system?.comfyui_version ?? ''
)
const currentVersion = computed(() => {
if (isCloud) {
return systemStatsStore?.systemStats?.system?.cloud_version ?? ''
}
return systemStatsStore?.systemStats?.system?.comfyui_version ?? ''
})
// Release data from settings
const locale = computed(() => settingStore.get('Comfy.Locale'))
@@ -55,22 +57,33 @@ export const useReleaseStore = defineStore('release', () => {
// Helper constants
const THREE_DAYS_MS = 3 * 24 * 60 * 60 * 1000 // 3 days
const compareVersions = (
releaseVersion: string,
currentVer: string
): number => {
if (valid(releaseVersion) && valid(currentVer)) {
return compare(releaseVersion, currentVer)
}
// Non-semver (e.g. git hash): assume different = newer
return releaseVersion === currentVer ? 0 : 1
}
// New version available?
const isNewVersionAvailable = computed(
() =>
!!recentRelease.value &&
compare(
compareVersions(
recentRelease.value.version,
currentComfyUIVersion.value || '0.0.0'
currentVersion.value || '0.0.0'
) > 0
)
const isLatestVersion = computed(
() =>
!!recentRelease.value &&
compare(
compareVersions(
recentRelease.value.version,
currentComfyUIVersion.value || '0.0.0'
currentVersion.value || '0.0.0'
) === 0
)
@@ -158,23 +171,25 @@ export const useReleaseStore = defineStore('release', () => {
return true
})
// Show "What's New" popup
const shouldShowPopup = computed(() => {
// Only show on desktop version
if (!isElectron() || isCloud) {
if (!isElectron() && !isCloud) {
return false
}
// Skip if notifications are disabled
if (!showVersionUpdates.value) {
return false
}
if (!isLatestVersion.value) {
if (!recentRelease.value) {
return false
}
// Skip version check if current version isn't semver (e.g. git hash)
const skipVersionCheck = !valid(currentVersion.value)
if (!skipVersionCheck && !isLatestVersion.value) {
return false
}
// Hide if already seen
if (
releaseVersion.value === recentRelease.value.version &&
releaseStatus.value === "what's new seen"
@@ -225,8 +240,7 @@ export const useReleaseStore = defineStore('release', () => {
return
}
// Skip fetching if notifications are disabled
if (!showVersionUpdates.value) {
if (!isCloud && !showVersionUpdates.value) {
return
}
@@ -248,8 +262,8 @@ export const useReleaseStore = defineStore('release', () => {
}
const fetchedReleases = await releaseService.getReleases({
project: 'comfyui',
current_version: currentComfyUIVersion.value,
project: isCloud ? 'cloud' : 'comfyui',
current_version: currentVersion.value,
form_factor: systemStatsStore.getFormFactor(),
locale: stringToLocale(locale.value)
})