Merge branch 'feat/cnr' into manager-ext

This commit is contained in:
Dr.Lt.Data
2024-09-24 02:21:11 +09:00
10 changed files with 2060 additions and 1904 deletions

View File

@@ -51,7 +51,9 @@ is_local_mode = args.listen.startswith('127.') or args.listen.startswith('local.
def is_allowed_security_level(level):
if level == 'high':
if level == 'block':
return False
elif level == 'high':
if is_local_mode:
return core.get_config()['security_level'].lower() in ['weak', 'normal-']
else:
@@ -62,7 +64,7 @@ def is_allowed_security_level(level):
return True
async def get_risky_level(files):
async def get_risky_level(files, pip_packages):
json_data1 = await core.get_data_by_mode('local', 'custom-node-list.json')
json_data2 = await core.get_data_by_mode('cache', 'custom-node-list.json', channel_url='https://github.com/ltdrdata/ComfyUI-Manager/raw/main')
@@ -74,6 +76,15 @@ async def get_risky_level(files):
if x not in all_urls:
return "high"
all_pip_packages = set()
for x in json_data1['custom_nodes'] + json_data2['custom_nodes']:
if "pip" in x:
all_pip_packages.update(x['pip'])
for p in pip_packages:
if p not in all_pip_packages:
return "block"
return "middle"