From 052f4983659f268dbb1e588077191c91fd314af2 Mon Sep 17 00:00:00 2001 From: bymyself Date: Sat, 11 Oct 2025 21:03:35 -0700 Subject: [PATCH] add distribution type build var --- .../helpcenter/HelpCenterMenuContent.vue | 39 ++++++++++++------- src/platform/distribution/types.ts | 18 +++++++++ tsconfig.json | 1 + vite.config.mts | 8 +++- 4 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 src/platform/distribution/types.ts diff --git a/src/components/helpcenter/HelpCenterMenuContent.vue b/src/components/helpcenter/HelpCenterMenuContent.vue index a58cb4a761..bfa1cbc963 100644 --- a/src/components/helpcenter/HelpCenterMenuContent.vue +++ b/src/components/helpcenter/HelpCenterMenuContent.vue @@ -135,6 +135,7 @@ import type { CSSProperties, Component } from 'vue' import { useI18n } from 'vue-i18n' import PuzzleIcon from '@/components/icons/PuzzleIcon.vue' +import { isCloud } from '@/platform/distribution/types' import { useSettingStore } from '@/platform/settings/settingStore' import type { ReleaseNote } from '@/platform/updates/common/releaseService' import { useReleaseStore } from '@/platform/updates/common/releaseStore' @@ -265,7 +266,7 @@ const moreMenuItem = computed(() => ) const menuItems = computed(() => { - return [ + const items: MenuItem[] = [ { key: 'docs', type: 'item', @@ -305,8 +306,12 @@ const menuItems = computed(() => { void commandStore.execute('Comfy.ContactSupport') emit('close') } - }, - { + } + ] + + // Extension manager - only in non-cloud distributions + if (!isCloud) { + items.push({ key: 'manager', type: 'item', icon: PuzzleIcon, @@ -319,17 +324,20 @@ const menuItems = computed(() => { }) emit('close') } - }, - { - key: 'more', - type: 'item', - icon: '', - label: t('helpCenter.more'), - visible: hasVisibleMoreItems.value, - action: () => {}, // No action for more item - items: moreItems.value - } - ] + }) + } + + items.push({ + key: 'more', + type: 'item', + icon: '', + label: t('helpCenter.more'), + visible: hasVisibleMoreItems.value, + action: () => {}, // No action for more item + items: moreItems.value + }) + + return items }) // Utility Functions @@ -420,6 +428,9 @@ const formatReleaseDate = (dateString?: string): string => { } const shouldShowUpdateButton = (release: ReleaseNote): boolean => { + // Hide update buttons in cloud distribution + if (isCloud) return false + return ( releaseStore.shouldShowUpdateButton && release === releaseStore.recentReleases[0] diff --git a/src/platform/distribution/types.ts b/src/platform/distribution/types.ts new file mode 100644 index 0000000000..8da7109736 --- /dev/null +++ b/src/platform/distribution/types.ts @@ -0,0 +1,18 @@ +/** + * Distribution types and compile-time constants for managing + * multi-distribution builds (Desktop, Localhost, Cloud) + */ + +type Distribution = 'desktop' | 'localhost' | 'cloud' + +declare global { + const __DISTRIBUTION__: Distribution +} + +/** Current distribution - replaced at compile time */ +const DISTRIBUTION: Distribution = __DISTRIBUTION__ + +/** Distribution type checks */ +// const isDesktop = DISTRIBUTION === 'desktop' +// const isLocalhost = DISTRIBUTION === 'localhost' +export const isCloud = DISTRIBUTION === 'cloud' diff --git a/tsconfig.json b/tsconfig.json index e98c48c4d9..ba0d3de224 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -58,6 +58,7 @@ "src/types/**/*.d.ts", "tailwind.config.ts", "tests-ui/**/*", + "vite.config.mts", "vitest.config.ts", // "vitest.setup.ts", ] diff --git a/vite.config.mts b/vite.config.mts index 32de5f6edb..c68f386f1e 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -24,6 +24,11 @@ const DISABLE_VUE_PLUGINS = process.env.DISABLE_VUE_PLUGINS === 'true' const DEV_SERVER_COMFYUI_URL = process.env.DEV_SERVER_COMFYUI_URL || 'http://127.0.0.1:8188' +const DISTRIBUTION = (process.env.DISTRIBUTION || 'localhost') as + | 'desktop' + | 'localhost' + | 'cloud' + export default defineConfig({ base: '', server: { @@ -195,7 +200,8 @@ export default defineConfig({ __SENTRY_DSN__: JSON.stringify(process.env.SENTRY_DSN || ''), __ALGOLIA_APP_ID__: JSON.stringify(process.env.ALGOLIA_APP_ID || ''), __ALGOLIA_API_KEY__: JSON.stringify(process.env.ALGOLIA_API_KEY || ''), - __USE_PROD_CONFIG__: process.env.USE_PROD_CONFIG === 'true' + __USE_PROD_CONFIG__: process.env.USE_PROD_CONFIG === 'true', + __DISTRIBUTION__: JSON.stringify(DISTRIBUTION) }, resolve: {