Skip to content

Commit 1be37e8

Browse files
author
RiceRound
committed
code review
1 parent 2a93c17 commit 1be37e8

7 files changed

Lines changed: 647 additions & 202 deletions

File tree

__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,21 @@ async def fix_toml(request):
282282
@web.middleware
283283
async def check_login_status(request, handler):
284284
if is_on_riceround:
285+
if request.path.startswith("/internal/"):
286+
return await handler(request)
285287
if (
286288
request.headers.get("owner") == "share_client"
287289
and request.headers.get("client_random") == client_random
288290
):
289291
return await handler(request)
292+
else:
293+
try:
294+
headers = dict(request.headers)
295+
logging.warn(f"### check_login_status failed - Headers: {headers}")
296+
except Exception as e:
297+
logging.warn(
298+
f"### check_login_status failed - Error parsing request: {str(e)}"
299+
)
290300
return web.json_response({"error": "Access denied"}, status=403)
291301
return await handler(request)
292302

encrypt_node.py

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ def encrypt(self, project_name, template_id, images, **kwargs):
139139
PromptServer.instance.send_sync(
140140
"riceround_toast", {"content": "发布失败,请检查发布步骤", "type": "error"}
141141
)
142-
return {}
143142
else:
144143
PromptServer.instance.send_sync(
145144
"riceround_toast",
@@ -575,8 +574,10 @@ def _transform_node_types(self, prompt):
575574
def add_decrypt_node(self, workflow):
576575
new_node_ids = set()
577576
self.last_node_id += 1
577+
decrypt_node_id = self.last_node_id
578+
decrypt_to_save_link_id = self.last_link_id + 1
578579
encrypt_node = {
579-
"id": self.last_node_id,
580+
"id": decrypt_node_id,
580581
"type": "RiceRoundDecryptNode",
581582
"pos": [420, 0],
582583
"size": [500, 150],
@@ -593,7 +594,10 @@ def add_decrypt_node(self, workflow):
593594
"slot_index": 0,
594595
}
595596
],
596-
"properties": {"Node name for S&R": "RiceRoundDecryptNode"},
597+
"properties": {
598+
"Node name for S&R": "RiceRoundDecryptNode",
599+
"cnr_id": "comfyui_riceround",
600+
},
597601
"widgets_values": [str(self.template_id), 735127949069071, "randomize"],
598602
}
599603
for idx, (owner_id, owner_node) in enumerate(self.input_node_map.items()):
@@ -611,11 +615,38 @@ def add_decrypt_node(self, workflow):
611615
encrypt_node["inputs"].append(input_entry)
612616
if link_type not in ["IMAGE", "STRING"]:
613617
link_type = "STRING"
614-
links = [link_id, owner_id, 0, self.last_node_id, idx, link_type]
618+
links = [link_id, owner_id, 0, decrypt_node_id, idx, link_type]
615619
workflow["links"].append(links)
620+
self.last_node_id += 1
621+
save_image_node = {
622+
"id": self.last_node_id,
623+
"type": "SaveImage",
624+
"pos": [982, 5],
625+
"size": [315, 58],
626+
"flags": {},
627+
"order": 21,
628+
"mode": 0,
629+
"inputs": [
630+
{
631+
"name": "images",
632+
"type": "IMAGE",
633+
"link": decrypt_to_save_link_id,
634+
"label": "图像",
635+
}
636+
],
637+
"outputs": [],
638+
"properties": {"Node name for S&R": "SaveImage", "cnr_id": "comfy-core"},
639+
"widgets_values": ["ComfyUI"],
640+
}
641+
encrypt_node["outputs"][0]["links"] = [decrypt_to_save_link_id]
642+
workflow["links"].append(
643+
[decrypt_to_save_link_id, decrypt_node_id, 0, self.last_node_id, 0, "IMAGE"]
644+
)
645+
new_node_ids.add(decrypt_node_id)
616646
new_node_ids.add(self.last_node_id)
617-
workflow["nodes"].append(encrypt_node)
647+
workflow["nodes"].extend([encrypt_node, save_image_node])
618648
workflow["last_node_id"] = self.last_node_id
649+
workflow["last_link_id"] = decrypt_to_save_link_id
619650
return new_node_ids
620651

621652
def output_file(self, workflow, prefix):

0 commit comments

Comments
 (0)