Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9edca916f | ||
|
|
40edd368b9 | ||
|
|
be146f983d | ||
|
|
42e6979cbe | ||
|
|
2cd48a8e6c | ||
|
|
40482abac9 | ||
|
|
9e1e224af1 | ||
|
|
cc5f1cc532 | ||
|
|
ae51e92df2 | ||
|
|
967de883db | ||
|
|
cbc597ce25 | ||
|
|
0187c72807 | ||
|
|
7b8e3138f2 | ||
|
|
a3c89b1b39 | ||
|
|
c9c5aef804 | ||
|
|
331710cb03 | ||
|
|
8dfd5354cb |
@@ -2,6 +2,71 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
### A list request without `mode` is answered
|
||||
|
||||
`GET /customnode/getlist`, `/customnode/getmappings` and
|
||||
`/externalmodel/getlist` answered 500 with `KeyError: 'mode'` when the
|
||||
request had no `mode` (#2740). Such a request is now answered as one with
|
||||
`mode=cache`. The pages of the Manager always send `mode`, so nothing changes
|
||||
for them.
|
||||
|
||||
### The Version column no longer shows an older registry version as an update
|
||||
|
||||
The Version column of the Custom Nodes Manager showed `[↑<version>]` whenever
|
||||
the installed version was not the latest version of the registry, so a
|
||||
nodepack installed at 1.78.1 showed `[↑1.47.0]` when the registry had 1.47.0
|
||||
as its latest (#3272). The arrow is now shown only when the version of the
|
||||
registry is newer. For a version that is not only numbers, such as
|
||||
`2.0.0rc1`, an enabled nodepack shows the arrow when an update is offered for
|
||||
it, and a disabled one is as before. The **Update** button is not changed: it
|
||||
was already offered only for a newer version.
|
||||
|
||||
### aria2 does not download a file that is already there
|
||||
|
||||
With aria2 as the downloader, an install of a model whose file was already in
|
||||
its folder downloaded the model once more. aria2 saved the download next to
|
||||
the file under another name (`<name>.1.<ext>`), and the install was reported
|
||||
as done. Nothing is downloaded now and the file that is there is kept, as
|
||||
with an install without aria2. A part of a file that aria2 keeps a control
|
||||
file for (`<name>.aria2`) is still continued.
|
||||
|
||||
### An aria2 on the same machine can be the downloader
|
||||
|
||||
With aria2 as the downloader, the Manager asks aria2 to save a file into
|
||||
`/models/...` or `/custom_nodes`, which is where the container of
|
||||
`docs/en/use_aria2.md` sees the folders of ComfyUI. An aria2 that runs on the
|
||||
same machine without a container cannot write there, and its downloads failed
|
||||
(#2999). With `COMFYUI_MANAGER_ARIA2_SAME_PATHS=true` the Manager gives aria2
|
||||
each folder as ComfyUI sees it. Without the variable nothing changes.
|
||||
|
||||
### A download through aria2 that fails is reported as failed
|
||||
|
||||
With `COMFYUI_MANAGER_ARIA2_SERVER` set, the Manager did not look at what
|
||||
aria2 did with a download. A model was reported as installed when aria2 had
|
||||
failed the download, or had saved the file in a folder that ComfyUI does not
|
||||
read. A download that aria2 had queued behind others was not waited for: a
|
||||
model was reported as installed before its file was there, and the install of
|
||||
a registry nodepack failed with `Failed to extract archive`. An install now
|
||||
waits for a download that aria2 has queued, and fails with the error of aria2
|
||||
when aria2 fails the download, or when the download is paused or removed in
|
||||
aria2 before it is complete. It also fails when the file is not where
|
||||
ComfyUI reads it, as when aria2 does not see the ComfyUI folder as `/`
|
||||
(`docs/en/use_aria2.md`): the terminal names the folder that aria2 wrote to.
|
||||
When the download of the archive of a registry nodepack fails, the part that
|
||||
was downloaded and the control file of aria2 no longer stay in `custom_nodes`.
|
||||
|
||||
### A nodepack that two node mappings name shows all its nodes, and the list is drawn
|
||||
|
||||
Two node mappings can name one nodepack, one by its id or git URL and one by
|
||||
its `title_aux`. In the Custom Nodes Manager the second mapping replaced the
|
||||
nodes of the first. When another nodepack had a node of the first mapping,
|
||||
the page failed with `TypeError: Cannot read properties of undefined (reading
|
||||
'conflicts')` and drew no list (#2502). A node that both mappings name showed
|
||||
a conflict with no other nodepack, or each other nodepack twice. The Nodes
|
||||
column and the node list of such a nodepack now have the nodes of both
|
||||
mappings, and each conflict names each other nodepack once. A row can
|
||||
therefore list more nodes than before.
|
||||
|
||||
### The Model Manager finds a model in a subfolder of an extra model path
|
||||
|
||||
A model whose folder in the list has a subfolder, such as `checkpoints/SD1.5`,
|
||||
|
||||
+35
-13
@@ -31593,16 +31593,6 @@
|
||||
"description": "Ambrosinus ToolKit - Streamlined workflow export with transparent backgrounds, professional themes, and smart scaling. Perfect for creating clean, high-resolution workflow documentation and sharing.",
|
||||
"category": "Utils"
|
||||
},
|
||||
{
|
||||
"author": "wasilone11",
|
||||
"title": "ComfyUI Sync Lipsync Node",
|
||||
"reference": "https://github.com/wasilone11/comfyui-sync-lipsync-node",
|
||||
"files": [
|
||||
"https://github.com/wasilone11/comfyui-sync-lipsync-node"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "This custom node allows you to perform audio-video lip synchronization inside ComfyUI using a simple interface."
|
||||
},
|
||||
{
|
||||
"author": "wasilone11",
|
||||
"title": "ComfyUI Sync PVM Node",
|
||||
@@ -62740,12 +62730,23 @@
|
||||
"author": "haryai",
|
||||
"title": "Seedance 2.5 (HaryAI)",
|
||||
"id": "seedance-comfyui",
|
||||
"reference": "https://github.com/sunsiyuan/seedance-comfyui",
|
||||
"reference": "https://github.com/haryai-com/seedance-comfyui",
|
||||
"files": [
|
||||
"https://github.com/sunsiyuan/seedance-comfyui"
|
||||
"https://github.com/haryai-com/seedance-comfyui"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Seedance 2.5 and Seedance 2.5 Flash video generation through the HaryAI API: text to video, first and last frame, reference images, sound. No BytePlus account needed."
|
||||
"description": "Superseded by HaryAI (comfyui-haryai), which has the same nodes plus chat. Seedance 2.5 video and Seedream / Nano Banana images through the HaryAI API: text to video, first and last frame, reference images, videos and audio, draft mode, text to image and edits. Needs a HaryAI API key in the node's api_key field; requests go to api.haryai.com."
|
||||
},
|
||||
{
|
||||
"author": "haryai",
|
||||
"title": "HaryAI",
|
||||
"id": "comfyui-haryai",
|
||||
"reference": "https://github.com/haryai-com/comfyui-haryai",
|
||||
"files": [
|
||||
"https://github.com/haryai-com/comfyui-haryai"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Nodes for HaryAI's models: Seedance video (text to video, first and last frame, reference images, videos and audio, draft mode), Seedream and Nano Banana images (text to image and edits), and DeepSeek chat for writing video prompts and storyboards in a workflow. Billed to a HaryAI balance; needs a HaryAI API key in each node's api_key field (saved in the workflow); requests go to api.haryai.com."
|
||||
},
|
||||
{
|
||||
"author": "zhulinyv",
|
||||
@@ -62830,6 +62831,27 @@
|
||||
"install_type": "git-clone",
|
||||
"description": "Nodes for the AssetFeed API: AssetFeed OCR reads the text in an image, and AssetFeed AI Text Check estimates the AI-written share of an English text. Needs an ASSETFEED_API_KEY environment variable; images and text are sent to api.assetfeed.com; data handling is in the README."
|
||||
},
|
||||
{
|
||||
"author": "Orange-3DV-Team",
|
||||
"title": "MoBack-Turbo",
|
||||
"id": "moback-turbo",
|
||||
"reference": "https://github.com/Orange-3DV-Team/MoBack",
|
||||
"files": [
|
||||
"https://github.com/Orange-3DV-Team/MoBack"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "End-to-end 4-step video background replacement with text (Task A), background image (Task B), or edited-keyframe (Task C) guidance based on Wan2.2 and Qwen3-VL (Linux/CUDA). Uses native VIDEO ports and supports resident, --offload-dit, and --low-vram (24 GB VRAM) modes."
|
||||
},
|
||||
{
|
||||
"author": "Valentin Klein",
|
||||
"title": "ValiTools",
|
||||
"reference": "https://github.com/vangel76/comfyui-ValiTools",
|
||||
"files": [
|
||||
"https://github.com/vangel76/comfyui-ValiTools"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "ValiTools node collection: VSmartPrompt (Dynamic Prompts with a rich-text editor, reusable variables, switcher conditions, chaining inputs and post-run selection highlighting), VFileRandom (no-repeat random image loader), VRandomSelector (lazy random passthrough of N same-type inputs) and VWaitForVRAM (hold execution until enough VRAM is free)."
|
||||
},
|
||||
{
|
||||
"author": "ntdviet",
|
||||
"title": "ntdviet/comfyui-ext",
|
||||
|
||||
@@ -38,3 +38,13 @@ services:
|
||||
options:
|
||||
max-size: 1m
|
||||
```
|
||||
|
||||
## aria2 on the same machine, without a container
|
||||
|
||||
The Manager asks aria2 to save a file into `/models/...` or `/custom_nodes`. The container above sees the `models` and `custom_nodes` folders of ComfyUI there, through its volumes.
|
||||
|
||||
An aria2 that runs on the same machine as ComfyUI, without a container, sees these folders where ComfyUI sees them. For it, set one more variable. The Manager then gives aria2 each folder as it is.
|
||||
|
||||
```bash
|
||||
export COMFYUI_MANAGER_ARIA2_SAME_PATHS=true
|
||||
```
|
||||
|
||||
@@ -1325,7 +1325,11 @@ class UnifiedManager:
|
||||
if os.path.exists(install_path):
|
||||
return result.fail(f'Install path already exists: {install_path}')
|
||||
|
||||
manager_downloader.download_url(node_info.download_url, get_default_custom_nodes_path(), archive_name)
|
||||
try:
|
||||
manager_downloader.download_url(node_info.download_url, get_default_custom_nodes_path(), archive_name)
|
||||
except Exception:
|
||||
manager_downloader.remove_failed_download(get_default_custom_nodes_path(), archive_name)
|
||||
raise
|
||||
os.makedirs(install_path, exist_ok=True)
|
||||
try:
|
||||
extracted = manager_util.extract_package_as_zip(download_path, install_path)
|
||||
|
||||
@@ -80,17 +80,26 @@ def aria2_download_url(model_url: str, model_dir: str, filename: str):
|
||||
import tqdm
|
||||
import time
|
||||
|
||||
if model_dir.startswith(core.comfy_path):
|
||||
model_dir = model_dir[len(core.comfy_path) :]
|
||||
local_path = os.path.join(model_dir, filename)
|
||||
|
||||
download_dir = model_dir if model_dir.startswith('/') else os.path.join('/models', model_dir)
|
||||
same_paths = os.environ.get('COMFYUI_MANAGER_ARIA2_SAME_PATHS', '').lower() == 'true'
|
||||
|
||||
if not same_paths and model_dir.startswith(core.comfy_path):
|
||||
rel = model_dir[len(core.comfy_path):]
|
||||
download_dir = rel if rel.startswith('/') else os.path.join('/models', rel)
|
||||
elif os.path.isabs(model_dir):
|
||||
download_dir = model_dir
|
||||
else:
|
||||
download_dir = os.path.join('/models', model_dir)
|
||||
|
||||
download = aria2_find_task(download_dir, filename)
|
||||
if download is None:
|
||||
if download is None or not (download.is_active or download.is_waiting):
|
||||
if os.path.exists(local_path) and not os.path.exists(local_path + '.aria2'):
|
||||
return
|
||||
options = {'dir': download_dir, 'out': filename}
|
||||
download = aria2.add(model_url, options)[0]
|
||||
|
||||
if download.is_active:
|
||||
if download.is_active or download.is_waiting:
|
||||
with tqdm.tqdm(
|
||||
total=download.total_length,
|
||||
bar_format='{l_bar}{bar}{r_bar}',
|
||||
@@ -98,13 +107,27 @@ def aria2_download_url(model_url: str, model_dir: str, filename: str):
|
||||
unit='B',
|
||||
unit_scale=True,
|
||||
) as progress_bar:
|
||||
while download.is_active:
|
||||
while download.is_active or download.is_waiting:
|
||||
if progress_bar.total == 0 and download.total_length != 0:
|
||||
progress_bar.reset(download.total_length)
|
||||
progress_bar.update(download.completed_length - progress_bar.n)
|
||||
time.sleep(1)
|
||||
download.update()
|
||||
|
||||
if not download.is_complete:
|
||||
raise Exception(f"aria2 failed to download '{model_url}' into '{download_dir}': {download.error_message or download.status}")
|
||||
if not os.path.exists(local_path):
|
||||
raise Exception(f"aria2 saved '{filename}' into its '{download_dir}', but the file is not at '{local_path}'. "
|
||||
"See docs/en/use_aria2.md for where aria2 must see the folders of ComfyUI.")
|
||||
|
||||
|
||||
def remove_failed_download(model_dir: str, filename: str):
|
||||
for name in (filename, filename + '.aria2'):
|
||||
try:
|
||||
os.remove(os.path.join(model_dir, name))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def download_url_with_agent(url, save_path):
|
||||
try:
|
||||
|
||||
@@ -735,7 +735,7 @@ async def fetch_customnode_mappings(request):
|
||||
"""
|
||||
provide unified (node -> node pack) mapping list
|
||||
"""
|
||||
mode = request.rel_url.query["mode"]
|
||||
mode = request.rel_url.query.get("mode", "cache")
|
||||
|
||||
nickname_mode = False
|
||||
if mode == "nickname":
|
||||
@@ -1125,14 +1125,16 @@ async def fetch_customnode_list(request):
|
||||
"""
|
||||
provide unified custom node list
|
||||
"""
|
||||
if request.rel_url.query["mode"] == "local":
|
||||
mode = request.rel_url.query.get("mode", "cache")
|
||||
|
||||
if mode == "local":
|
||||
channel = 'local'
|
||||
else:
|
||||
channel = core.get_config()['channel_url']
|
||||
|
||||
node_packs = await core.get_unified_total_nodes(channel, request.rel_url.query["mode"], 'cache')
|
||||
json_obj_github = core.get_data_by_mode(request.rel_url.query["mode"], 'github-stats.json', 'default')
|
||||
json_obj_extras = core.get_data_by_mode(request.rel_url.query["mode"], 'extras.json', 'default')
|
||||
node_packs = await core.get_unified_total_nodes(channel, mode, 'cache')
|
||||
json_obj_github = core.get_data_by_mode(mode, 'github-stats.json', 'default')
|
||||
json_obj_extras = core.get_data_by_mode(mode, 'extras.json', 'default')
|
||||
|
||||
core.populate_github_stats(node_packs, await json_obj_github)
|
||||
core.populate_favorites(node_packs, await json_obj_extras)
|
||||
@@ -1216,7 +1218,7 @@ def check_model_installed(json_obj):
|
||||
@routes.get("/externalmodel/getlist")
|
||||
async def fetch_externalmodel_list(request):
|
||||
# The model list is only allowed in the default channel, yet.
|
||||
json_obj = await core.get_data_by_mode(request.rel_url.query["mode"], 'model-list.json')
|
||||
json_obj = await core.get_data_by_mode(request.rel_url.query.get("mode", "cache"), 'model-list.json')
|
||||
|
||||
check_model_installed(json_obj)
|
||||
|
||||
|
||||
@@ -21,6 +21,25 @@ const gridId = "node";
|
||||
|
||||
const INVALID_INSTALLATION_GUIDANCE = "This nodepack was not installed through ComfyUI-Manager, or its installation is damaged, so the Manager cannot update it. Reinstalling deletes its folder and installs the nodepack again.";
|
||||
|
||||
// Compare dot-separated numeric version specs. Returns 1 if a > b, -1 if a < b,
|
||||
// 0 if equal, or null when either spec is not fully numeric (e.g. "nightly",
|
||||
// "1.2.3rc1").
|
||||
function compareVersionSpecs(a, b) {
|
||||
const pa = String(a).split(".").map((x) => /^\d+$/.test(x) ? parseInt(x, 10) : NaN);
|
||||
const pb = String(b).split(".").map((x) => /^\d+$/.test(x) ? parseInt(x, 10) : NaN);
|
||||
if (pa.some(Number.isNaN) || pb.some(Number.isNaN)) {
|
||||
return null;
|
||||
}
|
||||
const len = Math.max(pa.length, pb.length);
|
||||
for (let i = 0; i < len; i++) {
|
||||
const x = pa[i] || 0;
|
||||
const y = pb[i] || 0;
|
||||
if (x > y) return 1;
|
||||
if (x < y) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const pageHtml = `
|
||||
<div class="cn-manager cn-manager-dark">
|
||||
<div class="cn-manager-grid"></div>
|
||||
@@ -864,7 +883,17 @@ export class CustomNodesManager {
|
||||
if(version == 'nightly') {
|
||||
return `<div>${safeVersion}</div><div>[${safeLatest}]</div>`;
|
||||
}
|
||||
return `<div>${safeVersion}</div><div>[↑${safeLatest}]</div>`;
|
||||
// Flag an update only when the registry version is provably newer
|
||||
// (cmp === 1). cmp === -1/0 means the local install is already
|
||||
// current or newer (issue #3272: 1.78.1 was flagged as updatable
|
||||
// to 1.47.0).
|
||||
const cmp = compareVersionSpecs(rowItem.cnr_latest, version);
|
||||
const serverChecked = rowItem.state === 'enabled';
|
||||
const newer = cmp === null && serverChecked ? rowItem['update-state'] === 'true' : cmp === null || cmp === 1;
|
||||
if(newer) {
|
||||
return `<div>${safeVersion}</div><div>[↑${safeLatest}]</div>`;
|
||||
}
|
||||
return safeVersion;
|
||||
}
|
||||
return safeVersion;
|
||||
}
|
||||
@@ -1321,6 +1350,7 @@ export class CustomNodesManager {
|
||||
}
|
||||
|
||||
const conflictsMap = {};
|
||||
const nodesMapByPack = new Map();
|
||||
|
||||
// add nodes data
|
||||
Object.keys(data).forEach(k => {
|
||||
@@ -1333,9 +1363,12 @@ export class CustomNodesManager {
|
||||
// deduped
|
||||
const eList = Array.from(new Set(nodes));
|
||||
|
||||
nodeItem.nodes = eList.length;
|
||||
const nodesMap = {};
|
||||
const nodesMap = nodesMapByPack.get(nodeItem) || {};
|
||||
nodesMapByPack.set(nodeItem, nodesMap);
|
||||
eList.forEach(extName => {
|
||||
if (nodesMap[extName]) {
|
||||
return;
|
||||
}
|
||||
nodesMap[extName] = {
|
||||
name: extName
|
||||
};
|
||||
@@ -1347,6 +1380,7 @@ export class CustomNodesManager {
|
||||
cList.push(nodeItem.key);
|
||||
});
|
||||
nodeItem.nodesMap = nodesMap;
|
||||
nodeItem.nodes = Object.keys(nodesMap).length;
|
||||
} else {
|
||||
// should be removed
|
||||
// console.log("not found", k, title, nodes)
|
||||
|
||||
@@ -4631,16 +4631,6 @@
|
||||
"install_type": "git-clone",
|
||||
"description": "Minimal custom node that enables comprehensive Datadog APM tracing and profiling for ComfyUI.\nNOTE: The files in the repo are not organized."
|
||||
},
|
||||
{
|
||||
"author": "synchronicity-labs",
|
||||
"title": "ComfyUI Sync Lipsync Node",
|
||||
"reference": "https://github.com/synchronicity-labs/sync-comfyui",
|
||||
"files": [
|
||||
"https://github.com/synchronicity-labs/sync-comfyui"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "NODES: WanVideo T5 Apply Soft Prefix"
|
||||
},
|
||||
{
|
||||
"author": "NSFW-API",
|
||||
"title": "ComfyUI-WanSoftPrefix",
|
||||
|
||||
@@ -10,16 +10,6 @@
|
||||
"install_type": "git-clone",
|
||||
"description": "Patched fork of ComfyUI-MultiGPU providing universal .safetensors and GGUF multi-GPU distribution with DisTorch 2.0 engine, model-driven allocation options (bytes/ratio modes), WanVideoWrapper integration, and up to 10% faster GGUF inference. (Description by CC)"
|
||||
},
|
||||
{
|
||||
"author": "synchronicity-labs",
|
||||
"title": "ComfyUI Sync Lipsync Node",
|
||||
"reference": "https://github.com/synchronicity-labs/sync-comfyui",
|
||||
"files": [
|
||||
"https://github.com/synchronicity-labs/sync-comfyui"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "This custom node allows you to perform audio-video lip synchronization inside ComfyUI using a simple interface."
|
||||
},
|
||||
{
|
||||
"author": "joaomede",
|
||||
"title": "ComfyUI-Unload-Model-Fork",
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
{
|
||||
"custom_nodes": [
|
||||
{
|
||||
"author": "Valentin Klein",
|
||||
"title": "ValiTools",
|
||||
"reference": "https://github.com/vangel76/comfyui-ValiTools",
|
||||
"files": [
|
||||
"https://github.com/vangel76/comfyui-ValiTools"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "ValiTools node collection: VSmartPrompt (Dynamic Prompts with a rich-text editor, reusable variables, switcher conditions, chaining inputs and post-run selection highlighting), VFileRandom (no-repeat random image loader), VRandomSelector (lazy random passthrough of N same-type inputs) and VWaitForVRAM (hold execution until enough VRAM is free)."
|
||||
},
|
||||
{
|
||||
"author": "Orange-3DV-Team",
|
||||
"title": "MoBack-Turbo",
|
||||
"id": "moback-turbo",
|
||||
"reference": "https://github.com/Orange-3DV-Team/MoBack",
|
||||
"files": [
|
||||
"https://github.com/Orange-3DV-Team/MoBack"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "End-to-end 4-step video background replacement with text (Task A), background image (Task B), or edited-keyframe (Task C) guidance based on Wan2.2 and Qwen3-VL (Linux/CUDA). Uses native VIDEO ports and supports resident, --offload-dit, and --low-vram (24 GB VRAM) modes."
|
||||
},
|
||||
{
|
||||
"author": "haryai",
|
||||
"title": "HaryAI",
|
||||
"id": "comfyui-haryai",
|
||||
"reference": "https://github.com/haryai-com/comfyui-haryai",
|
||||
"files": [
|
||||
"https://github.com/haryai-com/comfyui-haryai"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Nodes for HaryAI's models: Seedance video (text to video, first and last frame, reference images, videos and audio, draft mode), Seedream and Nano Banana images (text to image and edits), and DeepSeek chat for writing video prompts and storyboards in a workflow. Billed to a HaryAI balance; needs a HaryAI API key in each node's api_key field (saved in the workflow); requests go to api.haryai.com."
|
||||
},
|
||||
{
|
||||
"author": "AceDataCloud",
|
||||
"title": "GPT Image",
|
||||
@@ -316,12 +348,12 @@
|
||||
"author": "haryai",
|
||||
"title": "Seedance 2.5 (HaryAI)",
|
||||
"id": "seedance-comfyui",
|
||||
"reference": "https://github.com/sunsiyuan/seedance-comfyui",
|
||||
"reference": "https://github.com/haryai-com/seedance-comfyui",
|
||||
"files": [
|
||||
"https://github.com/sunsiyuan/seedance-comfyui"
|
||||
"https://github.com/haryai-com/seedance-comfyui"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Seedance 2.5 and Seedance 2.5 Flash video generation through the HaryAI API: text to video, first and last frame, reference images, sound. No BytePlus account needed."
|
||||
"description": "Superseded by HaryAI (comfyui-haryai), which has the same nodes plus chat. Seedance 2.5 video and Seedream / Nano Banana images through the HaryAI API: text to video, first and last frame, reference images, videos and audio, draft mode, text to image and edits. Needs a HaryAI API key in the node's api_key field; requests go to api.haryai.com."
|
||||
},
|
||||
{
|
||||
"author": "codalanguez",
|
||||
|
||||
@@ -765,7 +765,11 @@ def execute_lazy_cnr_switch(target, zip_url, from_path, to_path, no_deps, custom
|
||||
# 1. download
|
||||
archive_name = f"CNR_temp_{str(uuid.uuid4())}.zip" # should be unpredictable name - security precaution
|
||||
download_path = os.path.join(custom_nodes_path, archive_name)
|
||||
manager_downloader.download_url(zip_url, custom_nodes_path, archive_name)
|
||||
try:
|
||||
manager_downloader.download_url(zip_url, custom_nodes_path, archive_name)
|
||||
except Exception:
|
||||
manager_downloader.remove_failed_download(custom_nodes_path, archive_name)
|
||||
raise
|
||||
|
||||
try:
|
||||
extracted = manager_util.switch_package_files(download_path, from_path)
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from test_install_flags_config import _run_child
|
||||
|
||||
posix_folder = pytest.mark.skipif(os.name == 'nt', reason='the folder that aria2 gets is a POSIX path')
|
||||
|
||||
|
||||
PRELUDE = '''
|
||||
import time
|
||||
md = manager_core.manager_downloader
|
||||
manager_core.comfy_path = tmp
|
||||
time.sleep = lambda seconds: None
|
||||
LOCAL = os.path.join(tmp, 'models', 'checkpoints', 'y.safetensors')
|
||||
TARGET = '/models/checkpoints/y.safetensors'
|
||||
|
||||
class FakeDownload:
|
||||
def __init__(self, statuses, local_file=None, error_message=None, target=None):
|
||||
self._statuses = list(statuses)
|
||||
self.status = self._statuses.pop(0)
|
||||
self._local_file = local_file
|
||||
self.error_message = error_message
|
||||
self.total_length = 10
|
||||
self.completed_length = 0
|
||||
self.files = [type('F', (), {'is_metadata': False, 'path': target})()] if target else []
|
||||
self._write_if_complete()
|
||||
|
||||
def _write_if_complete(self):
|
||||
if self.status == 'complete' and self._local_file:
|
||||
os.makedirs(os.path.dirname(self._local_file), exist_ok=True)
|
||||
open(self._local_file, 'wb').close()
|
||||
|
||||
is_active = property(lambda self: self.status == 'active')
|
||||
is_waiting = property(lambda self: self.status == 'waiting')
|
||||
has_failed = property(lambda self: self.status == 'error')
|
||||
is_complete = property(lambda self: self.status == 'complete')
|
||||
|
||||
def update(self):
|
||||
if self._statuses:
|
||||
self.status = self._statuses.pop(0)
|
||||
self._write_if_complete()
|
||||
|
||||
class FakeAria2:
|
||||
def __init__(self, new, existing=()):
|
||||
self.new, self.existing, self.added = new, list(existing), []
|
||||
|
||||
def get_downloads(self):
|
||||
return self.existing
|
||||
|
||||
def add(self, url, options):
|
||||
self.added.append(dict(options))
|
||||
return [self.new]
|
||||
|
||||
def install(fake):
|
||||
md.aria2 = fake
|
||||
error = None
|
||||
try:
|
||||
md.download_url('https://huggingface.co/x/y.safetensors', os.path.dirname(LOCAL), 'y.safetensors')
|
||||
except Exception as e:
|
||||
error = str(e)
|
||||
print(json.dumps({'error': error, 'added': fake.added, 'status': fake.new.status, 'file': os.path.exists(LOCAL)}))
|
||||
'''
|
||||
|
||||
|
||||
def run(body):
|
||||
return _run_child(PRELUDE + body)
|
||||
|
||||
|
||||
def test_a_download_that_aria2_fails_raises_with_its_message():
|
||||
data = run('''
|
||||
install(FakeAria2(FakeDownload(['error'], error_message='Failed to make the directory /models/checkpoints, cause: Permission denied')))
|
||||
''')
|
||||
assert 'Permission denied' in data['error'], data
|
||||
|
||||
|
||||
@pytest.mark.parametrize('status', ['paused', 'removed'])
|
||||
def test_a_download_that_was_stopped_with_a_part_of_the_file_there_raises(status):
|
||||
data = run(f'''
|
||||
os.makedirs(os.path.dirname(LOCAL))
|
||||
open(LOCAL, 'wb').close()
|
||||
open(LOCAL + '.aria2', 'wb').close()
|
||||
install(FakeAria2(FakeDownload(['active', {status!r}])))
|
||||
''')
|
||||
assert status in data['error'], data
|
||||
|
||||
|
||||
def test_a_file_that_aria2_saved_elsewhere_raises():
|
||||
data = run('''
|
||||
install(FakeAria2(FakeDownload(['complete'])))
|
||||
''')
|
||||
assert 'y.safetensors' in data['error'] and 'docs/en/use_aria2.md' in data['error'], data
|
||||
|
||||
|
||||
@posix_folder
|
||||
def test_a_queued_download_is_waited_for():
|
||||
data = run('''
|
||||
install(FakeAria2(FakeDownload(['waiting', 'active', 'complete'], local_file=LOCAL)))
|
||||
''')
|
||||
assert data == {'error': None, 'added': [{'dir': '/models/checkpoints', 'out': 'y.safetensors'}], 'status': 'complete', 'file': True}
|
||||
|
||||
|
||||
@posix_folder
|
||||
def test_a_failed_earlier_download_is_not_reused():
|
||||
data = run('''
|
||||
install(FakeAria2(FakeDownload(['active', 'complete'], local_file=LOCAL), existing=[FakeDownload(['error'], target=TARGET)]))
|
||||
''')
|
||||
assert data['error'] is None and len(data['added']) == 1, data
|
||||
|
||||
|
||||
@posix_folder
|
||||
def test_a_finished_earlier_download_whose_file_is_there_is_reused():
|
||||
data = run('''
|
||||
os.makedirs(os.path.dirname(LOCAL))
|
||||
open(LOCAL, 'wb').close()
|
||||
install(FakeAria2(FakeDownload(['complete']), existing=[FakeDownload(['complete'], target=TARGET)]))
|
||||
''')
|
||||
assert data['error'] is None and data['added'] == [], data
|
||||
|
||||
|
||||
@posix_folder
|
||||
def test_an_earlier_download_that_is_still_queued_is_waited_for():
|
||||
data = run('''
|
||||
install(FakeAria2(FakeDownload(['complete']), existing=[FakeDownload(['waiting', 'active', 'complete'], local_file=LOCAL, target=TARGET)]))
|
||||
''')
|
||||
assert data['error'] is None and data['added'] == [] and data['file'], data
|
||||
|
||||
|
||||
def test_a_file_that_is_already_there_is_not_downloaded_again():
|
||||
data = run('''
|
||||
os.makedirs(os.path.dirname(LOCAL))
|
||||
open(LOCAL, 'wb').close()
|
||||
install(FakeAria2(FakeDownload(['complete'])))
|
||||
''')
|
||||
assert data['error'] is None and data['added'] == [], data
|
||||
|
||||
|
||||
def test_a_part_that_aria2_has_a_control_file_for_is_downloaded():
|
||||
data = run('''
|
||||
os.makedirs(os.path.dirname(LOCAL))
|
||||
open(LOCAL, 'wb').close()
|
||||
open(LOCAL + '.aria2', 'wb').close()
|
||||
install(FakeAria2(FakeDownload(['complete'])))
|
||||
''')
|
||||
assert data['error'] is None and len(data['added']) == 1, data
|
||||
|
||||
|
||||
def test_a_nodepack_archive_whose_download_fails_leaves_no_file():
|
||||
data = run('''
|
||||
nodes = os.path.join(tmp, 'custom_nodes')
|
||||
os.makedirs(nodes)
|
||||
manager_core.get_default_custom_nodes_path = lambda: nodes
|
||||
|
||||
class Aria2ThatFailsHalfway(FakeAria2):
|
||||
def add(self, url, options):
|
||||
for name in (options['out'], options['out'] + '.aria2'):
|
||||
open(os.path.join(nodes, name), 'wb').close()
|
||||
return super().add(url, options)
|
||||
|
||||
md.aria2 = Aria2ThatFailsHalfway(FakeDownload(['error'], error_message='the speed was too low'))
|
||||
error = None
|
||||
try:
|
||||
manager_core.UnifiedManager()._cnr_install('fixture', types.SimpleNamespace(version='1.0.0', download_url='https://example.invalid/fixture.zip'))
|
||||
except Exception as e:
|
||||
error = str(e)
|
||||
print(json.dumps({'error': error, 'left': os.listdir(nodes)}))
|
||||
''')
|
||||
assert 'the speed was too low' in data['error'] and data['left'] == [], data
|
||||
@@ -0,0 +1,58 @@
|
||||
import os
|
||||
|
||||
from test_install_flags_config import _run_child
|
||||
|
||||
|
||||
PRELUDE = '''
|
||||
md = manager_core.manager_downloader
|
||||
manager_core.comfy_path = tmp
|
||||
|
||||
class FakeDownload:
|
||||
is_active = is_waiting = has_failed = False
|
||||
is_complete = True
|
||||
|
||||
class FakeAria2:
|
||||
def __init__(self, model_dir):
|
||||
self.model_dir, self.added = model_dir, []
|
||||
|
||||
def get_downloads(self):
|
||||
return []
|
||||
|
||||
def add(self, url, options):
|
||||
self.added.append(dict(options))
|
||||
open(os.path.join(self.model_dir, options['out']), 'wb').close()
|
||||
return [FakeDownload()]
|
||||
|
||||
def dir_given_to_aria2(model_dir):
|
||||
md.aria2 = FakeAria2(model_dir)
|
||||
os.makedirs(model_dir, exist_ok=True)
|
||||
md.download_url('https://huggingface.co/x/y.safetensors', model_dir, 'y.safetensors')
|
||||
return md.aria2.added[0]['dir']
|
||||
|
||||
checkpoints = os.path.join(tmp, 'models', 'checkpoints')
|
||||
custom_nodes = os.path.join(tmp, 'custom_nodes')
|
||||
outside = os.path.join(tempfile.mkdtemp(), 'checkpoints')
|
||||
print(json.dumps({
|
||||
'checkpoints': [checkpoints, dir_given_to_aria2(checkpoints)],
|
||||
'custom_nodes': [custom_nodes, dir_given_to_aria2(custom_nodes)],
|
||||
'outside': [outside, dir_given_to_aria2(outside)],
|
||||
}))
|
||||
'''
|
||||
|
||||
|
||||
def run(setting):
|
||||
return _run_child(f"os.environ['COMFYUI_MANAGER_ARIA2_SAME_PATHS'] = {setting!r}\n" + PRELUDE)
|
||||
|
||||
|
||||
def test_by_default_aria2_gets_the_comfyui_folder_as_its_root():
|
||||
for setting in ('', 'false'):
|
||||
data = run(setting)
|
||||
assert data['checkpoints'][1] == os.sep + os.path.join('models', 'checkpoints')
|
||||
assert data['custom_nodes'][1] == os.sep + 'custom_nodes'
|
||||
assert data['outside'][1] == data['outside'][0]
|
||||
|
||||
|
||||
def test_with_same_paths_aria2_gets_each_folder_as_it_is():
|
||||
data = run('true')
|
||||
for local, given in data.values():
|
||||
assert given == local
|
||||
@@ -374,6 +374,10 @@ class DenialConstantsTest(unittest.TestCase):
|
||||
def _assert_honest_copy(self, const, flag_name):
|
||||
self.assertIn(flag_name, const, "constant must name the responsible flag")
|
||||
self.assertIn("config.ini", const, "constant must name config.ini")
|
||||
# The gate is `flag AND loopback` (is_dedicated_install_allowed), so a
|
||||
# message that stops at the flag sends non-loopback users to re-check a
|
||||
# setting they already enabled.
|
||||
self.assertIn("loopback", const, "constant must name the loopback requirement")
|
||||
for cause_phrasing in (
|
||||
"is not allowed in this security_level",
|
||||
"set the security level",
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import pytest
|
||||
|
||||
from test_default_channel import COMFY_ORG, run
|
||||
|
||||
ROUTES = ['fetch_customnode_list', 'fetch_customnode_mappings', 'fetch_externalmodel_list']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('route', ROUTES)
|
||||
def test_a_request_without_mode_is_answered_as_mode_cache(route):
|
||||
without, cache, local = run(f'''
|
||||
import re
|
||||
configure(None, {COMFY_ORG!r})
|
||||
start()
|
||||
handler = server({route!r})
|
||||
handler.update(nodes=SimpleNamespace(NODE_CLASS_MAPPINGS={{}}), re=re, check_model_installed=lambda listed: None)
|
||||
|
||||
def ask(**query):
|
||||
return json.loads(asyncio.run(handler[{route!r}](SimpleNamespace(rel_url=SimpleNamespace(query=query)))).text)
|
||||
|
||||
emit([ask(), ask(mode='cache'), ask(mode='local')])
|
||||
''')
|
||||
|
||||
assert without == cache != local
|
||||
@@ -0,0 +1,111 @@
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from html.parser import HTMLParser
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from js_lift import NODE, JsSource, run_node, slice_braced, slice_object_entry
|
||||
|
||||
JS = JsSource(Path(os.environ.get("MANAGER_JS_DIR") or (Path(__file__).resolve().parent.parent / "js")))
|
||||
MANAGER = "custom-nodes-manager.js"
|
||||
|
||||
pytestmark = pytest.mark.skipif(NODE is None, reason="node is required to execute the lifted production JS")
|
||||
|
||||
|
||||
class NodesFlyover(HTMLParser):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.nodes = {}
|
||||
self.open = []
|
||||
self.row = None
|
||||
|
||||
def handle_starttag(self, tag, attrs):
|
||||
if tag == "div":
|
||||
self.open.append((dict(attrs).get("class") or "").split())
|
||||
|
||||
def handle_endtag(self, tag):
|
||||
if tag == "div":
|
||||
self.open.pop()
|
||||
|
||||
def handle_data(self, data):
|
||||
if self.open and "cn-nodes-name" in self.open[-1]:
|
||||
self.row = data
|
||||
self.nodes[data] = []
|
||||
elif self.open and "cn-nodes-pack" in self.open[-1] and self.row is not None:
|
||||
self.nodes[self.row].append(data)
|
||||
|
||||
|
||||
def shown(packs, mappings):
|
||||
source = JS.text(MANAGER)
|
||||
column = slice_object_entry(source, 'id: "nodes",')
|
||||
script = """
|
||||
%s
|
||||
%s
|
||||
const formatter = %s;
|
||||
const manager_instance = {datasrc_combo: {value: 'cache'}};
|
||||
const fetchData = async () => ({data: %s});
|
||||
const manager = {
|
||||
showStatus() {},
|
||||
flyover: {show(title, body) { manager.body = body; }},
|
||||
%s,
|
||||
%s
|
||||
};
|
||||
const packs = %s;
|
||||
await manager.loadNodes(packs);
|
||||
const rows = {};
|
||||
for (const [key, rowItem] of Object.entries(packs)) {
|
||||
manager.body = '';
|
||||
manager.showNodes({rowItem});
|
||||
rows[key] = {column: String(formatter(null, rowItem, {})), flyover: manager.body};
|
||||
}
|
||||
console.log(JSON.stringify(rows));
|
||||
""" % (JS.lift_declaration("common.js", "export function sanitizeHTML("),
|
||||
JS.lift_declaration("common.js", "export const icons = "),
|
||||
column[column.index("formatter:") + len("formatter:"):].strip(),
|
||||
json.dumps(mappings),
|
||||
slice_braced(source, "\tasync loadNodes(node_packs) "),
|
||||
JS.lift_span(MANAGER, "\tshowNodes(d) {", "\t\tthis.flyover.show(titleHtml, bodyHtml);\n\t}"),
|
||||
json.dumps({key: {"key": key, "title": key, "hash": key, "state": "enabled"} for key in packs}))
|
||||
view = {}
|
||||
for key, row in run_node(script).items():
|
||||
flyover = NodesFlyover()
|
||||
flyover.feed(row["flyover"])
|
||||
view[key] = {"column": " ".join(re.sub(r"<[^>]+>", " ", row["column"]).split()), "nodes": flyover.nodes}
|
||||
return view
|
||||
|
||||
|
||||
def test_the_nodes_of_both_mappings_are_shown_and_each_conflict_names_its_peer():
|
||||
view = shown(["A", "B"], {
|
||||
"https://example.invalid/A": [["Shared"], {}],
|
||||
"other": [["Own"], {"title_aux": "A"}],
|
||||
"B": [["Shared"], {}],
|
||||
})
|
||||
|
||||
assert view == {
|
||||
"A": {"column": "2 nodes 1 conflict", "nodes": {"Shared": ["B"], "Own": []}},
|
||||
"B": {"column": "1 node 1 conflict", "nodes": {"Shared": ["A"]}},
|
||||
}
|
||||
|
||||
|
||||
def test_a_node_in_both_mappings_of_a_pack_is_no_conflict_with_itself():
|
||||
view = shown(["A"], {
|
||||
"https://example.invalid/A": [["Shared"], {}],
|
||||
"other": [["Shared"], {"title_aux": "A"}],
|
||||
})
|
||||
|
||||
assert view == {"A": {"column": "1 node", "nodes": {"Shared": []}}}
|
||||
|
||||
|
||||
def test_a_node_in_both_mappings_of_a_pack_names_another_pack_once():
|
||||
view = shown(["A", "B"], {
|
||||
"https://example.invalid/A": [["Shared"], {}],
|
||||
"other": [["Shared"], {"title_aux": "A"}],
|
||||
"B": [["Shared"], {}],
|
||||
})
|
||||
|
||||
assert view == {
|
||||
"A": {"column": "1 node 1 conflict", "nodes": {"Shared": ["B"]}},
|
||||
"B": {"column": "1 node 1 conflict", "nodes": {"Shared": ["A"]}},
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
"""RED->GREEN guard for the Version column's CNR update badge (issue #3272).
|
||||
|
||||
WHY
|
||||
---
|
||||
The Custom Nodes grid's Version column used to decide whether to render the
|
||||
``[↑x.y.z]`` update badge with a bare string inequality:
|
||||
|
||||
if(rowItem.cnr_latest && version != rowItem.cnr_latest) {
|
||||
|
||||
String comparison says ``"1.47.0" != "1.78.1"``, so a node installed at
|
||||
1.78.1 was flagged as updatable to 1.47.0 -- exactly the report in #3272,
|
||||
confirmed by maintainers there. The backend never had this bug:
|
||||
``is_updatable`` in glob/manager_core.py compares ``packaging`` versions via
|
||||
``safe_version``. The fix adds a module-level ``compareVersionSpecs`` helper
|
||||
to js/custom-nodes-manager.js and gates the badge on the registry version
|
||||
being PROVABLY newer (cmp === 1); when either spec is not fully numeric
|
||||
("nightly", "1.2.3rc1", ...) the helper returns null, and the formatter
|
||||
follows the server's update-state for an enabled nodepack and keeps the legacy
|
||||
string behavior for any other row.
|
||||
|
||||
A side effect pinned here: glob/manager_core.py injects ``cnr_latest =
|
||||
'0.0.0'`` when the registry has no ``latest_version``. Under the string
|
||||
inequality that rendered a nonsensical ``[↑0.0.0]`` badge on every such row;
|
||||
under the numeric compare 0.0.0 is simply older than the install, so no
|
||||
badge.
|
||||
|
||||
REPRODUCE THE RED HALF against the pre-fix revision -- one command:
|
||||
mkdir -p /some/dir
|
||||
git show <base>:js/custom-nodes-manager.js > /some/dir/custom-nodes-manager.js
|
||||
git show <base>:js/common.js > /some/dir/common.js
|
||||
MANAGER_JS_DIR=/some/dir pytest tests/test_version_badge_semver.py
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from js_lift import NODE, JsSource, run_node, slice_braced, slice_object_entry
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
JS = JsSource(os.environ.get("MANAGER_JS_DIR") or (REPO_ROOT / "js"))
|
||||
|
||||
MANAGER = "custom-nodes-manager.js"
|
||||
COMMON = "common.js"
|
||||
|
||||
VERSION_ANCHOR = "id: 'version',"
|
||||
HELPER_MARKER = "function compareVersionSpecs"
|
||||
|
||||
|
||||
def _helper_source() -> str:
|
||||
"""The module-level compareVersionSpecs, lifted from the shipped file."""
|
||||
return slice_braced(JS.text(MANAGER), HELPER_MARKER)
|
||||
|
||||
|
||||
def _version_formatter() -> str:
|
||||
"""The Version column formatter, lifted verbatim out of its array entry."""
|
||||
block = slice_object_entry(JS.text(MANAGER), VERSION_ANCHOR)
|
||||
marker = "formatter:"
|
||||
return block[block.index(marker) + len(marker):].strip()
|
||||
|
||||
|
||||
def _sanitize_html_source() -> str:
|
||||
return JS.lift_declaration(COMMON, "export function sanitizeHTML(")
|
||||
|
||||
|
||||
def _render(formatter_source: str, installed, cnr_latest, **row) -> str:
|
||||
script = "\n".join([
|
||||
_sanitize_html_source(),
|
||||
_helper_source(),
|
||||
"const formatter = %s;" % (formatter_source,),
|
||||
"const rowItem = %s;" % json.dumps({"cnr_latest": cnr_latest, "originalData": {"id": "x"}, **row}),
|
||||
"console.log(JSON.stringify({markup: String(formatter(%s, rowItem, {}))}));"
|
||||
% json.dumps(installed),
|
||||
])
|
||||
return run_node(script)["markup"]
|
||||
|
||||
|
||||
# The installed/cnr_latest pairs the badge decision must get right, with the
|
||||
# exact markup a correct formatter returns for each.
|
||||
BADGE = "<div>%s</div><div>[↑%s]</div>"
|
||||
|
||||
CASES = [
|
||||
# (installed, cnr_latest, expected, why)
|
||||
("1.78.1", "1.47.0", "1.78.1",
|
||||
"issue #3272: locally newer must NOT be flagged as updatable"),
|
||||
("1.47.0", "1.47.0", "1.47.0",
|
||||
"equal versions: no badge"),
|
||||
("1.0.0", "1.47.0", BADGE % ("1.0.0", "1.47.0"),
|
||||
"registry is genuinely newer: badge kept"),
|
||||
("1.78.1", "0.0.0", "1.78.1",
|
||||
"manager_core's 'no latest_version' sentinel must not render [↑0.0.0]"),
|
||||
("0.0.0", "1.47.0", BADGE % ("0.0.0", "1.47.0"),
|
||||
"a 0.0.0 install is still older than the registry: badge kept"),
|
||||
("1.2", "1.10.0", BADGE % ("1.2", "1.10.0"),
|
||||
"numeric compare: 1.10.0 > 1.2 (a string compare would miss this update)"),
|
||||
("1.10.0", "1.2", "1.10.0",
|
||||
"numeric compare: 1.10.0 > 1.2, so no badge"),
|
||||
("nightly", "1.47.0", "<div>nightly</div><div>[1.47.0]</div>",
|
||||
"the nightly branch is untouched: no arrow, badge-free"),
|
||||
("1.2.3rc1", "1.47.0", BADGE % ("1.2.3rc1", "1.47.0"),
|
||||
"unparseable spec: legacy string behavior kept"),
|
||||
]
|
||||
|
||||
|
||||
UNORDERED_CASES = [
|
||||
("2.0.0rc1", "1.47.0", "enabled", "false", "2.0.0rc1",
|
||||
"a release candidate of a newer version is not behind the registry"),
|
||||
("1.0.0-beta.2", "0.9.0", "enabled", "false", "1.0.0-beta.2",
|
||||
"a beta of a newer version is not behind the registry"),
|
||||
("1.0.0", "nightly", "enabled", "false", "1.0.0",
|
||||
"a nodepack without a version in the registry has nothing to update to"),
|
||||
("1.2.3rc1", "1.47.0", "enabled", "true", BADGE % ("1.2.3rc1", "1.47.0"),
|
||||
"the server offers the update: badge kept"),
|
||||
("1.2.3rc1", "1.47.0", "disabled", "false", BADGE % ("1.2.3rc1", "1.47.0"),
|
||||
"disabled: the server has no answer, legacy string behavior kept"),
|
||||
("1.78.1", "1.47.0", "enabled", "true", "1.78.1",
|
||||
"versions the helper orders do not read update-state"),
|
||||
]
|
||||
|
||||
|
||||
@unittest.skipIf(NODE is None, "node is required to execute the lifted production JS")
|
||||
class VersionBadgeSemverTest(unittest.TestCase):
|
||||
"""The Version column formatter, lifted and executed as shipped."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.formatter = _version_formatter()
|
||||
|
||||
def _markup(self, installed, cnr_latest) -> str:
|
||||
return _render(self.formatter, installed, cnr_latest)
|
||||
|
||||
def test_the_badge_follows_numeric_ordering(self):
|
||||
for installed, latest, expected, why in CASES:
|
||||
with self.subTest(installed=installed, cnr_latest=latest):
|
||||
self.assertEqual(self._markup(installed, latest), expected, why)
|
||||
|
||||
def test_an_enabled_nodepack_follows_the_server_for_versions_the_helper_cannot_order(self):
|
||||
for installed, latest, state, update_state, expected, why in UNORDERED_CASES:
|
||||
with self.subTest(installed=installed, cnr_latest=latest, state=state):
|
||||
row = {"state": state, "update-state": update_state}
|
||||
self.assertEqual(_render(self.formatter, installed, latest, **row), expected, why)
|
||||
|
||||
|
||||
@unittest.skipIf(NODE is None, "node is required to execute the lifted production JS")
|
||||
class CompareVersionSpecsTest(unittest.TestCase):
|
||||
"""The helper itself, lifted and executed directly."""
|
||||
|
||||
def _compare(self, a, b):
|
||||
out = run_node(
|
||||
"%s\nconsole.log(JSON.stringify({r: compareVersionSpecs(%s, %s)}));"
|
||||
% (_helper_source(), json.dumps(a), json.dumps(b))
|
||||
)
|
||||
return out["r"]
|
||||
|
||||
def test_dot_separated_specs_order_numerically(self):
|
||||
self.assertEqual(self._compare("1.2.10", "1.2.9"), 1)
|
||||
self.assertEqual(self._compare("1.10.0", "1.9"), 1)
|
||||
self.assertEqual(self._compare("1.9", "1.10.0"), -1)
|
||||
self.assertEqual(self._compare("1.47.0", "1.47.0"), 0)
|
||||
self.assertEqual(self._compare("1.2", "1.2.0"), 0)
|
||||
|
||||
def test_non_numeric_specs_return_null(self):
|
||||
self.assertIsNone(self._compare("nightly", "1.47.0"))
|
||||
self.assertIsNone(self._compare("1.2.3rc1", "1.47.0"))
|
||||
self.assertIsNone(self._compare("1.47.0", ""))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,4 +1,5 @@
|
||||
import ast
|
||||
import importlib.util
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@@ -417,6 +418,27 @@ def test_reserved_switch_that_fails_leaves_no_archive(switch, tmp_path):
|
||||
assert archives(custom_nodes) == []
|
||||
|
||||
|
||||
def test_reserved_switch_whose_download_fails_leaves_no_archive(monkeypatch, tmp_path):
|
||||
custom_nodes = tmp_path / 'custom_nodes'
|
||||
old, new = old_version(custom_nodes, 'fixture@1_0_0'), custom_nodes / 'fixture@2_0_0'
|
||||
|
||||
def download(url, directory, name):
|
||||
for part in (name, name + '.aria2'):
|
||||
(custom_nodes / part).write_text('a part of the archive')
|
||||
raise Exception('the download failed')
|
||||
|
||||
spec = importlib.util.spec_from_file_location('_manager_downloader_under_test', GLOB_DIR / 'manager_downloader.py')
|
||||
downloader = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(downloader)
|
||||
downloader.download_url = download
|
||||
switch = startup_functions(lambda name, module: monkeypatch.setitem(sys.modules, name, module), manager_downloader=downloader)['execute_lazy_cnr_switch']
|
||||
|
||||
with pytest.raises(Exception, match='the download failed'):
|
||||
switch('fixture', 'https://example.invalid/fixture.zip', str(old), str(new), False, str(custom_nodes), 'NodeVersionStatusActive')
|
||||
|
||||
assert sorted(os.listdir(custom_nodes)) == ['fixture@1_0_0', 'removed.py']
|
||||
|
||||
|
||||
def test_switch_at_once_that_fails_leaves_no_archive(tmp_path):
|
||||
custom_nodes = tmp_path / 'custom_nodes'
|
||||
(old_version(custom_nodes, 'fixture') / '.tracking').unlink()
|
||||
|
||||
Reference in New Issue
Block a user