mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-24 08:44:06 +00:00
Centralized management of external links (#4471)
Update the desktop guide links to make them platform and locale-aware Edited by Terry: Refactor external link management by introducing a centralized useExternalLink composable with automatic locale and platform detection for documentation URLs. - Created useExternalLink composable - A new centralized utility for managing all external links - Dynamic docs URL builder (buildDocsUrl) - Automatically constructs docs.comfy.org URLs with: - Locale detection (Chinese vs English) - Platform detection (macOS vs Windows for desktop) - Flexible path construction with options ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-4471-Add-platform-and-locale-aware-desktop-guide-URL-2346d73d3650815ea4a4dd64be575bbe) by [Unito](https://www.unito.io) --------- Co-authored-by: Terry Jia <terryjia88@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import log from 'loglevel'
|
||||
|
||||
import { useExternalLink } from '@/composables/useExternalLink'
|
||||
import { PYTHON_MIRROR } from '@/constants/uvMirrors'
|
||||
import { t } from '@/i18n'
|
||||
import { useToastStore } from '@/platform/updates/common/toastStore'
|
||||
@@ -8,13 +9,6 @@ import { app } from '@/scripts/app'
|
||||
import { useDialogService } from '@/services/dialogService'
|
||||
import { checkMirrorReachable } from '@/utils/electronMirrorCheck'
|
||||
import { electronAPI as getElectronAPI, isElectron } from '@/utils/envUtil'
|
||||
|
||||
// Desktop documentation URLs
|
||||
const DESKTOP_DOCS = {
|
||||
WINDOWS: 'https://docs.comfy.org/installation/desktop/windows',
|
||||
MACOS: 'https://docs.comfy.org/installation/desktop/macos'
|
||||
} as const
|
||||
|
||||
;(async () => {
|
||||
if (!isElectron()) return
|
||||
|
||||
@@ -22,6 +16,7 @@ const DESKTOP_DOCS = {
|
||||
const desktopAppVersion = await electronAPI.getElectronVersion()
|
||||
const workflowStore = useWorkflowStore()
|
||||
const toastStore = useToastStore()
|
||||
const { staticUrls, buildDocsUrl } = useExternalLink()
|
||||
|
||||
const onChangeRestartApp = (newValue: string, oldValue: string) => {
|
||||
// Add a delay to allow changes to take effect before restarting.
|
||||
@@ -165,11 +160,13 @@ const DESKTOP_DOCS = {
|
||||
label: 'Desktop User Guide',
|
||||
icon: 'pi pi-book',
|
||||
function() {
|
||||
const docsUrl =
|
||||
electronAPI.getPlatform() === 'darwin'
|
||||
? DESKTOP_DOCS.MACOS
|
||||
: DESKTOP_DOCS.WINDOWS
|
||||
window.open(docsUrl, '_blank')
|
||||
window.open(
|
||||
buildDocsUrl('/installation/desktop', {
|
||||
includeLocale: true,
|
||||
platform: true
|
||||
}),
|
||||
'_blank'
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -304,7 +301,7 @@ const DESKTOP_DOCS = {
|
||||
aboutPageBadges: [
|
||||
{
|
||||
label: 'ComfyUI_desktop v' + desktopAppVersion,
|
||||
url: 'https://github.com/Comfy-Org/electron',
|
||||
url: staticUrls.githubElectron,
|
||||
icon: 'pi pi-github'
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user