mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 20:51:58 +00:00
[refactor] centralize hardcoded URLs into organized constants
- Create src/constants/urls.ts with centralized URL constants (COMFY_URLS, GITHUB_REPOS, MODEL_SOURCES, DEVELOPER_TOOLS) - Move runtime domain config to src/config/comfyDomain.ts to allow forkers to customize via env var - Rename uvMirrors.ts to mirrors.ts for better naming consistency - Add platform and locale-aware desktop guide URL generation (matching PR #4471) - Update 10 components to use centralized URL constants - Add comprehensive unit and e2e tests for URL constants validation This refactoring improves maintainability by centralizing 150+ hardcoded URLs found across 50+ files into a single organized structure.
This commit is contained in:
@@ -123,6 +123,7 @@ import Button from 'primevue/button'
|
||||
import { type CSSProperties, computed, nextTick, onMounted, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { COMFY_URLS, GITHUB_REPOS, getDesktopGuideUrl } from '@/constants/urls'
|
||||
import { type ReleaseNote } from '@/services/releaseService'
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import { useReleaseStore } from '@/stores/releaseStore'
|
||||
@@ -143,11 +144,10 @@ interface MenuItem {
|
||||
|
||||
// Constants
|
||||
const EXTERNAL_LINKS = {
|
||||
DOCS: 'https://docs.comfy.org/',
|
||||
DISCORD: 'https://www.comfy.org/discord',
|
||||
GITHUB: 'https://github.com/comfyanonymous/ComfyUI',
|
||||
DESKTOP_GUIDE: 'https://comfyorg.notion.site/',
|
||||
UPDATE_GUIDE: 'https://docs.comfy.org/installation/update_comfyui'
|
||||
DOCS: COMFY_URLS.docs.base,
|
||||
DISCORD: COMFY_URLS.community.discord,
|
||||
GITHUB: GITHUB_REPOS.comfyui,
|
||||
UPDATE_GUIDE: COMFY_URLS.docs.installation.update
|
||||
} as const
|
||||
|
||||
const TIME_UNITS = {
|
||||
@@ -199,7 +199,7 @@ const menuItems = computed<MenuItem[]>(() => {
|
||||
type: 'item',
|
||||
label: t('helpCenter.desktopUserGuide'),
|
||||
action: () => {
|
||||
openExternalLink(EXTERNAL_LINKS.DESKTOP_GUIDE)
|
||||
openExternalLink(getDesktopGuideUrl(locale.value))
|
||||
emit('close')
|
||||
}
|
||||
},
|
||||
@@ -451,8 +451,8 @@ const onUpdate = (_: ReleaseNote): void => {
|
||||
const getChangelogUrl = (): string => {
|
||||
const isChineseLocale = locale.value === 'zh'
|
||||
return isChineseLocale
|
||||
? 'https://docs.comfy.org/zh-CN/changelog'
|
||||
: 'https://docs.comfy.org/changelog'
|
||||
? COMFY_URLS.docs.changelog.zh
|
||||
: COMFY_URLS.docs.changelog.en
|
||||
}
|
||||
|
||||
// Lifecycle
|
||||
|
||||
Reference in New Issue
Block a user