modified: Do not modify generated_models.py directly; use openapi.yaml instead.

This commit is contained in:
Dr.Lt.Data 2025-06-28 07:54:17 +09:00
parent 002e549a86
commit 43041cebed
4 changed files with 9 additions and 8 deletions

View File

@ -29,6 +29,7 @@ datamodel-codegen \
--use-subclass-enum \ --use-subclass-enum \
--field-constraints \ --field-constraints \
--strict-types bytes \ --strict-types bytes \
--use-double-quotes \
--input openapi.yaml \ --input openapi.yaml \
--output comfyui_manager/data_models/generated_models.py \ --output comfyui_manager/data_models/generated_models.py \
--output-model-type pydantic_v2.BaseModel --output-model-type pydantic_v2.BaseModel

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen: # generated by datamodel-codegen:
# filename: openapi.yaml # filename: openapi.yaml
# timestamp: 2025-06-21T23:40:24+00:00 # timestamp: 2025-06-27T04:01:45+00:00
from __future__ import annotations from __future__ import annotations
@ -109,9 +109,9 @@ class SecurityLevel(str, Enum):
class RiskLevel(str, Enum): class RiskLevel(str, Enum):
block = "block" block = "block"
high_p = "high+" high_ = "high+"
high = "high" high = "high"
middle_p = "middle+" middle_ = "middle+"
middle = "middle" middle = "middle"

View File

@ -17,7 +17,7 @@ def is_allowed_security_level(level):
if level == RiskLevel.block.value: if level == RiskLevel.block.value:
return False return False
elif level == RiskLevel.high_p.value: elif level == RiskLevel.high_.value:
if is_local_mode: if is_local_mode:
return core.get_config()['security_level'] in [SecurityLevel.weak.value, SecurityLevel.normal_.value] return core.get_config()['security_level'] in [SecurityLevel.weak.value, SecurityLevel.normal_.value]
elif is_personal_cloud: elif is_personal_cloud:
@ -29,7 +29,7 @@ def is_allowed_security_level(level):
return core.get_config()['security_level'] in [SecurityLevel.weak.value, SecurityLevel.normal_.value] return core.get_config()['security_level'] in [SecurityLevel.weak.value, SecurityLevel.normal_.value]
else: else:
return core.get_config()['security_level'] == SecurityLevel.weak.value return core.get_config()['security_level'] == SecurityLevel.weak.value
elif level == RiskLevel.middle_p.value: elif level == RiskLevel.middle_.value:
if is_local_mode or is_personal_cloud: if is_local_mode or is_personal_cloud:
return core.get_config()['security_level'] in [SecurityLevel.weak.value, SecurityLevel.normal.value, SecurityLevel.normal_.value] return core.get_config()['security_level'] in [SecurityLevel.weak.value, SecurityLevel.normal.value, SecurityLevel.normal_.value]
else: else:
@ -54,7 +54,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 RiskLevel.high_p.value 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"]:
@ -64,4 +64,4 @@ async def get_risky_level(files, pip_packages):
if p not in all_pip_packages: if p not in all_pip_packages:
return RiskLevel.block.value return RiskLevel.block.value
return RiskLevel.middle_p.value return RiskLevel.middle_.value

View File

@ -240,7 +240,7 @@ components:
description: Security level configuration (from most to least restrictive) description: Security level configuration (from most to least restrictive)
RiskLevel: RiskLevel:
type: string type: string
enum: [block, high, middle] enum: [block, high+, high, middle+, middle]
description: Risk classification for operations description: Risk classification for operations
ManagerPack: ManagerPack:
allOf: allOf: