diff --git a/CHANGELOG.md b/CHANGELOG.md index 7161e0063..ea5b7da16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning 2.0.0](https://semver.org/spec/ ## [Unreleased] +### Fixed + +- Report the `desktop-linux` form factor to the registry for Desktop installs + on Linux, which previously reported `other`. + ## [4.3] - 2026-09-19 ### Security diff --git a/comfyui_manager/common/cnr_utils.py b/comfyui_manager/common/cnr_utils.py index 7e62fcfb7..5a72096ba 100644 --- a/comfyui_manager/common/cnr_utils.py +++ b/comfyui_manager/common/cnr_utils.py @@ -20,6 +20,29 @@ lock = asyncio.Lock() is_cache_loading = False +def get_form_factor(): + """Form factor reported to the registry, based on environment and platform.""" + is_desktop = bool(os.environ.get('__COMFYUI_DESKTOP_VERSION__')) + system = platform.system().lower() + + if is_desktop: + if system == 'windows': + return 'desktop-win' + if system == 'darwin': + return 'desktop-mac' + if system == 'linux': + return 'desktop-linux' + return 'other' + + if system == 'windows': + return 'git-windows' + if system == 'darwin': + return 'git-mac' + if system == 'linux': + return 'git-linux' + return 'other' + + async def get_cnr_data(cache_mode=True, dont_wait=True): try: return await _get_cnr_data(cache_mode, dont_wait) @@ -39,12 +62,7 @@ async def _get_cnr_data(cache_mode=True, dont_wait=True): full_nodes = {} - # Determine form factor based on environment and platform is_desktop = bool(os.environ.get('__COMFYUI_DESKTOP_VERSION__')) - system = platform.system().lower() - is_windows = system == 'windows' - is_mac = system == 'darwin' - is_linux = system == 'linux' # Get ComfyUI version tag if is_desktop: @@ -53,22 +71,7 @@ async def _get_cnr_data(cache_mode=True, dont_wait=True): else: comfyui_ver = context.get_comfyui_tag() or 'unknown' - if is_desktop: - if is_windows: - form_factor = 'desktop-win' - elif is_mac: - form_factor = 'desktop-mac' - else: - form_factor = 'other' - else: - if is_windows: - form_factor = 'git-windows' - elif is_mac: - form_factor = 'git-mac' - elif is_linux: - form_factor = 'git-linux' - else: - form_factor = 'other' + form_factor = get_form_factor() from comfyui_manager.glob import manager_core verbose = manager_core.get_config().get('verbose', False) diff --git a/tests/test_form_factor.py b/tests/test_form_factor.py new file mode 100644 index 000000000..8cceac29f --- /dev/null +++ b/tests/test_form_factor.py @@ -0,0 +1,36 @@ +"""Form factor the CNR client reports to the registry.""" + +import pytest + +from _install_flags_testutil import import_context + + +@pytest.fixture +def cnr_utils(): + import_context() + from comfyui_manager.common import cnr_utils + + return cnr_utils + + +@pytest.mark.parametrize( + ('system', 'desktop', 'expected'), + [ + ('Windows', True, 'desktop-win'), + ('Darwin', True, 'desktop-mac'), + ('Linux', True, 'desktop-linux'), + ('FreeBSD', True, 'other'), + ('Windows', False, 'git-windows'), + ('Darwin', False, 'git-mac'), + ('Linux', False, 'git-linux'), + ('FreeBSD', False, 'other'), + ], +) +def test_form_factor(cnr_utils, monkeypatch, system, desktop, expected): + monkeypatch.setattr(cnr_utils.platform, 'system', lambda: system) + if desktop: + monkeypatch.setenv('__COMFYUI_DESKTOP_VERSION__', '1.0.0') + else: + monkeypatch.delenv('__COMFYUI_DESKTOP_VERSION__', raising=False) + + assert cnr_utils.get_form_factor() == expected