mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-13 08:04:24 +08:00
- Add client_id field to QueueTaskItem and TaskHistoryItem models - Implement client-specific WebSocket message routing - Add client filtering to queue status and history endpoints - Follow ComfyUI patterns for session management - Create data_models package for better code organization
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from comfyui_manager.glob import manager_core as core
|
|
|
|
|
|
def is_allowed_security_level(level):
|
|
if level == "block":
|
|
return False
|
|
elif level == "high":
|
|
if is_local_mode:
|
|
return core.get_config()["security_level"] in ["weak", "normal-"]
|
|
else:
|
|
return core.get_config()["security_level"] == "weak"
|
|
elif level == "middle":
|
|
return core.get_config()["security_level"] in ["weak", "normal", "normal-"]
|
|
else:
|
|
return True
|
|
|
|
|
|
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://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main",
|
|
)
|
|
|
|
all_urls = set()
|
|
for x in json_data1["custom_nodes"] + json_data2["custom_nodes"]:
|
|
all_urls.update(x.get("files", []))
|
|
|
|
for x in files:
|
|
if x not in all_urls:
|
|
return "high"
|
|
|
|
all_pip_packages = set()
|
|
for x in json_data1["custom_nodes"] + json_data2["custom_nodes"]:
|
|
all_pip_packages.update(x.get("pip", []))
|
|
|
|
for p in pip_packages:
|
|
if p not in all_pip_packages:
|
|
return "block"
|
|
|
|
return "middle"
|