Use module name without @version in /customnode/installed object key

This commit is contained in:
huchenlei 2024-12-19 15:22:50 -08:00
parent 9b5adfeb2c
commit 6fee2b8b10

View File

@ -546,25 +546,33 @@ def populate_markdown(x):
async def installed_list(request):
result = {}
for x in folder_paths.get_folder_paths('custom_nodes'):
for y in os.listdir(x):
if y.endswith('.disabled') or y == '__pycache__' or y.endswith('.py') or y.endswith('.example'):
for module_name in os.listdir(x):
if (
module_name.endswith('.disabled') or
module_name == '__pycache__' or
module_name.endswith('.py') or
module_name.endswith('.example') or
module_name.endswith('.pyc')
):
continue
spec = y.split('@')
spec = module_name.split('@')
if len(spec) == 2:
node_package_name = spec[0]
ver = spec[1].replace('_', '.')
if ver == 'nightly':
ver = None
else:
node_package_name = module_name
ver = None
# extract commit hash
if ver is None:
ver = core.get_commit_hash(os.path.join(x, y))
ver = core.get_commit_hash(os.path.join(x, node_package_name))
result[y] = ver
result[node_package_name] = ver
return web.json_response(result, content_type='application/json')