mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-27 03:19:56 +00:00
## Summary Extracts shared formatting and network utilities into dedicated workspace package. ## Changes - **What**: Created `@comfyorg/shared-frontend-utils` package containing formatUtil and networkUtil - **Breaking**: None - utilities remain accessible via path aliases in `tsconfig` Split `createAnnotatedPath` and `electronMirrorCheck` out and left in frontend, due to their tightly-coupled nature. See [discussion on this PR](https://github.com/Comfy-Org/ComfyUI_frontend/pull/5843#issuecomment-3344724727).
14 lines
420 B
TypeScript
14 lines
420 B
TypeScript
import { electronAPI } from '@/utils/envUtil'
|
|
import { isValidUrl } from '@/utils/formatUtil'
|
|
|
|
/**
|
|
* Check if a mirror is reachable from the electron App.
|
|
* @param mirror - The mirror to check.
|
|
* @returns True if the mirror is reachable, false otherwise.
|
|
*/
|
|
export const checkMirrorReachable = async (mirror: string) => {
|
|
return (
|
|
isValidUrl(mirror) && (await electronAPI().NetWork.canAccessUrl(mirror))
|
|
)
|
|
}
|