66 lines
1.9 KiB
Python
66 lines
1.9 KiB
Python
"""Fetch fixed raw text only. Never import/install/execute upstream code."""
|
|
|
|
import hashlib
|
|
import json
|
|
from datetime import datetime, timezone
|
|
from pathlib import Path
|
|
from urllib.request import urlopen
|
|
|
|
ROOT = Path("docs/hel-892/setget-reference")
|
|
COMMIT = "ab72eda7ffad6280422d71ab7d54d3fb87c0ba18"
|
|
rows = []
|
|
|
|
|
|
def fetch(repo, commit, path, local, license):
|
|
url = f"https://raw.githubusercontent.com/{repo}/{commit}/{path}"
|
|
raw = urlopen(url, timeout=30).read()
|
|
target = ROOT / local
|
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
target.write_bytes(raw)
|
|
rows.append(
|
|
{
|
|
"id": f"{repo}@{commit}:{path}",
|
|
"commit": commit,
|
|
"raw_url": url,
|
|
"local_file": local,
|
|
"sha256": hashlib.sha256(raw).hexdigest(),
|
|
"retrieved_at": datetime.now(timezone.utc).isoformat(),
|
|
"license": license,
|
|
"lines": [[1, len(raw.decode().splitlines())]],
|
|
}
|
|
)
|
|
|
|
|
|
for p in [
|
|
"web/js/setgetnodes.js",
|
|
"web/js/utility.js",
|
|
"__init__.py",
|
|
"pyproject.toml",
|
|
"LICENSE",
|
|
]:
|
|
fetch("kijai/ComfyUI-KJNodes", COMMIT, p, p.replace("/", "__"), "GPL-3.0")
|
|
for version, sha in [
|
|
("1.37.11", "4bf6a1960028cc5cda57d48f9fb01a74dfaade43"),
|
|
("1.48.6", "7b4172a243e0d43f1679c0be1c307560cd83c00d"),
|
|
]:
|
|
for p in [
|
|
"src/config/comfyApi.ts",
|
|
"build/plugins/comfyAPIPlugin.ts",
|
|
"src/scripts/app.ts",
|
|
"src/lib/litegraph/src/LGraphNode.ts",
|
|
"src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
|
|
"src/utils/executionUtil.ts",
|
|
"LICENSE",
|
|
]:
|
|
fetch(
|
|
"Comfy-Org/ComfyUI_frontend",
|
|
sha,
|
|
p,
|
|
version + "__" + p.replace("/", "__"),
|
|
"GPL-3.0",
|
|
)
|
|
(ROOT / "sources.json").write_text(
|
|
json.dumps({"sources": rows}, ensure_ascii=False, indent=2) + "\n"
|
|
)
|
|
print("sources", len(rows))
|