mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2026-11-04 23:37:31 +00:00
[PR #3390] fix: resolve the default channel from channels.list in get_risky_level / 修复:get_risky_level 改为从 channels.list 解析 default 通道 #3259
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/ComfyUI-Manager#3259
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/ComfyUI-Manager/pull/3390
Author: @self-exiler
Created: 10/18/2026
Status: 🔄 Open
Base:
main← Head:fix/risky-level-channel-from-channel-list📝 Commits (5)
87cb312fix: resolve the default channel from channels.list in get_risky_levelc419b07warn when the resolved default channel uses plain HTTP1565db5gate plain-HTTP default channels on http_channel_enabled7bbe1ebmake the plain-HTTP scheme check case-insensitive40a4cc1normalize mixed-case http scheme before returning the default channel📊 Changes
3 files changed (+277 additions, -1 deletions)
View changed files
📝
glob/manager_core.py(+51 -0)📝
glob/manager_server.py(+1 -1)➕
tests/test_default_channel_resolution.py(+225 -0)📄 Description
Summary / 摘要
EN:
get_risky_level()inglob/manager_server.pypassed the literal URLhttps://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/mainwhen fetching thedefaultchannel'scustom-node-list.jsonfor the pre-install risk check. That request bypassedchannels.listandconfig.inientirely: users running the manager behind a mirror or proxy (mirror-prefixed channel entries, custom forks) still hit the upstream host on every install, and when that request failed the risk check silently lost thedefaulthalf of its data set (which can misclassify installable node packs ashighrisk undersecurity_level = normal).This PR adds
core.get_default_channel_url()and uses it inget_risky_level(). The URL is resolved in this order:defaultentry ofchannels.listconfig.ini'schannel_url(the channel used when a request does not name one — keeps custom-fork setups working whendefaultwas removed fromchannels.list)DEFAULT_CHANNEL(upstream) — i.e. the exact legacy hardcoded behaviorReading
channels.listmay fail (permissions, malformed file); such failures degrade to the next fallback instead of breaking the install path. With an unmodified setup the resolved URL is identical to the old hardcoded one, so behavior is unchanged unless the user has customized their channels.中文:
glob/manager_server.py的get_risky_level()在安装节点前获取default通道的custom-node-list.json做风险判定时,硬编码了https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main。该请求完全不经过channels.list与config.ini:使用镜像/代理(镜像前缀通道、自建 fork)的用户每次安装仍会直连上游;请求失败时风险判定会静默丢失 default 通道这一半数据(在security_level = normal下可能把本可安装的节点判为high而拦截)。本 PR 新增
core.get_default_channel_url()并在get_risky_level()中使用,解析顺序为:channels.list的default条目config.ini的channel_url(未显式指定通道时的默认通道——当用户从channels.list移除了default行时,自建 fork 场景仍可工作)DEFAULT_CHANNEL(上游)——即原有硬编码行为读取
channels.list失败(权限、文件损坏等)时降级到下一级兜底,不会破坏安装流程。未做任何自定义的环境下解析结果与旧硬编码值完全一致,行为不变。Changes / 改动
glob/manager_core.py: newget_default_channel_url()resolver / 新增get_default_channel_url()解析函数glob/manager_server.py:get_risky_level()now consumes the resolver /get_risky_level()改为使用该解析函数tests/test_default_channel_resolution.py: resolution-order cases + AST wiring guards (following thetest_install_flag_predicate.pyharness precedent, no new dependencies) / 解析顺序用例 + AST 接线守卫(沿用test_install_flag_predicate.py的测试范式,无新增依赖)Testing / 测试
python -m unittest tests.test_default_channel_resolution— 13 tests pass / 13 条用例全部通过default, custom fork, trailing-slash trim,defaultmissing →config.ini channel_url, both missing →DEFAULT_CHANNEL, emptychannel_url, unreadablechannels.list(degrades, no raise), plus static guards thatget_risky_levelcalls the resolver and noraw.githubusercontent.comliteral remains inmanager_server.py.default行回退config.ini、两者皆缺回退上游、空channel_url、channels.list不可读(降级不抛异常),以及静态守卫(get_risky_level调用解析函数、manager_server.py中不再有 raw 硬编码字面量)。🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.