revise /customnode/installed api (#1398)
* revise /customnode/installed
improved: don't fetch data from cnr for the api
improved: change format {<cnr id>: <version>} -> {<module>: [<version>, <cnr id>]}
* fix condition
* improved: add `mode=imported` for startup snapshot
`/customnode/installed` - current snapshot
`/customnode/installed?mode=imported` - startup snapshot
* improved: move cache dir to user directory
* modified: /customnodes/installed
- show whole nodes including disabled
- format changed `key -> list` to `key -> dict`
* fixed: doesn't show disabled node pack properly.
* Update workflow-metadata.js
---------
Co-authored-by: huchenlei <huchenlei@proton.me>
This commit is contained in:
@@ -129,3 +129,26 @@ def read_cnr_info(fullpath):
|
||||
return None
|
||||
except Exception:
|
||||
return None # not valid CNR node pack
|
||||
|
||||
|
||||
def generate_cnr_id(fullpath, cnr_id):
|
||||
cnr_id_path = os.path.join(fullpath, '.git', '.cnr-id')
|
||||
try:
|
||||
if not os.path.exists(cnr_id_path):
|
||||
with open(cnr_id_path, "w") as f:
|
||||
return f.write(cnr_id)
|
||||
except:
|
||||
print(f"[ComfyUI Manager] unable to create file: {cnr_id_path}")
|
||||
|
||||
|
||||
def read_cnr_id(fullpath):
|
||||
cnr_id_path = os.path.join(fullpath, '.git', '.cnr-id')
|
||||
try:
|
||||
if os.path.exists(cnr_id_path):
|
||||
with open(cnr_id_path) as f:
|
||||
return f.read().strip()
|
||||
except:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user