mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-19 11:23:00 +08:00
[fix] Remove unused imports to fix linting errors
This commit is contained in:
parent
03ecda3cfe
commit
14298b0859
@ -1,4 +1,3 @@
|
|||||||
from comfy.cli_args import args
|
|
||||||
|
|
||||||
SECURITY_MESSAGE_MIDDLE_OR_BELOW = "ERROR: To use this action, a security_level of `middle or below` is required. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
|
SECURITY_MESSAGE_MIDDLE_OR_BELOW = "ERROR: To use this action, a security_level of `middle or below` is required. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
|
||||||
SECURITY_MESSAGE_NORMAL_MINUS = "ERROR: To use this feature, you must either set '--listen' to a local IP and set the security level to 'normal-' or lower, or set the security level to 'middle' or 'weak'. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
|
SECURITY_MESSAGE_NORMAL_MINUS = "ERROR: To use this feature, you must either set '--listen' to a local IP and set the security level to 'normal-' or lower, or set the security level to 'middle' or 'weak'. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
|
||||||
@ -15,9 +14,6 @@ def is_loopback(address):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
is_local_mode = is_loopback(args.listen)
|
|
||||||
|
|
||||||
|
|
||||||
model_dir_name_map = {
|
model_dir_name_map = {
|
||||||
"checkpoints": "checkpoints",
|
"checkpoints": "checkpoints",
|
||||||
"checkpoint": "checkpoints",
|
"checkpoint": "checkpoints",
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
from comfyui_manager.glob import manager_core as core
|
from comfyui_manager.glob import manager_core as core
|
||||||
from comfy.cli_args import args
|
from comfy.cli_args import args
|
||||||
|
from comfyui_manager.data_models import SecurityLevel, RiskLevel, ManagerDatabaseSource
|
||||||
|
|
||||||
|
|
||||||
def is_loopback(address):
|
def is_loopback(address):
|
||||||
@ -13,23 +14,23 @@ def is_loopback(address):
|
|||||||
def is_allowed_security_level(level):
|
def is_allowed_security_level(level):
|
||||||
is_local_mode = is_loopback(args.listen)
|
is_local_mode = is_loopback(args.listen)
|
||||||
|
|
||||||
if level == "block":
|
if level == RiskLevel.block.value:
|
||||||
return False
|
return False
|
||||||
elif level == "high":
|
elif level == RiskLevel.high.value:
|
||||||
if is_local_mode:
|
if is_local_mode:
|
||||||
return core.get_config()["security_level"] in ["weak", "normal-"]
|
return core.get_config()["security_level"] in [SecurityLevel.weak.value, SecurityLevel.normal_.value]
|
||||||
else:
|
else:
|
||||||
return core.get_config()["security_level"] == "weak"
|
return core.get_config()["security_level"] == SecurityLevel.weak.value
|
||||||
elif level == "middle":
|
elif level == RiskLevel.middle.value:
|
||||||
return core.get_config()["security_level"] in ["weak", "normal", "normal-"]
|
return core.get_config()["security_level"] in [SecurityLevel.weak.value, SecurityLevel.normal.value, SecurityLevel.normal_.value]
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def get_risky_level(files, pip_packages):
|
async def get_risky_level(files, pip_packages):
|
||||||
json_data1 = await core.get_data_by_mode("local", "custom-node-list.json")
|
json_data1 = await core.get_data_by_mode(ManagerDatabaseSource.local.value, "custom-node-list.json")
|
||||||
json_data2 = await core.get_data_by_mode(
|
json_data2 = await core.get_data_by_mode(
|
||||||
"cache",
|
ManagerDatabaseSource.cache.value,
|
||||||
"custom-node-list.json",
|
"custom-node-list.json",
|
||||||
channel_url="https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main",
|
channel_url="https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main",
|
||||||
)
|
)
|
||||||
@ -40,7 +41,7 @@ async def get_risky_level(files, pip_packages):
|
|||||||
|
|
||||||
for x in files:
|
for x in files:
|
||||||
if x not in all_urls:
|
if x not in all_urls:
|
||||||
return "high"
|
return RiskLevel.high.value
|
||||||
|
|
||||||
all_pip_packages = set()
|
all_pip_packages = set()
|
||||||
for x in json_data1["custom_nodes"] + json_data2["custom_nodes"]:
|
for x in json_data1["custom_nodes"] + json_data2["custom_nodes"]:
|
||||||
@ -48,6 +49,6 @@ async def get_risky_level(files, pip_packages):
|
|||||||
|
|
||||||
for p in pip_packages:
|
for p in pip_packages:
|
||||||
if p not in all_pip_packages:
|
if p not in all_pip_packages:
|
||||||
return "block"
|
return RiskLevel.block.value
|
||||||
|
|
||||||
return "middle"
|
return RiskLevel.middle.value
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user