From 4927d81e73d73577f76f923506490f55e20287c0 Mon Sep 17 00:00:00 2001 From: bennykok Date: Tue, 17 Sep 2024 18:57:15 -0700 Subject: [PATCH] chore: accept cd_token --- custom_routes.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/custom_routes.py b/custom_routes.py index 86caee0..2c0a55a 100644 --- a/custom_routes.py +++ b/custom_routes.py @@ -368,14 +368,17 @@ def send_prompt(sid: str, inputs: StreamingPrompt): @server.PromptServer.instance.routes.post("/comfyui-deploy/run") async def comfy_deploy_run(request): # Extract the bearer token from the Authorization header - auth_header = request.headers.get('Authorization') - token = None - if auth_header: - parts = auth_header.split() - if len(parts) == 2 and parts[0].lower() == 'bearer': - token = parts[1] - data = await request.json() + + if "cd_token" in data: + token = data["cd_token"] + else: + auth_header = request.headers.get('Authorization') + token = None + if auth_header: + parts = auth_header.split() + if len(parts) == 2 and parts[0].lower() == 'bearer': + token = parts[1] # In older version, we use workflow_api, but this has inputs already swapped in nextjs frontend, which is tricky workflow_api = data.get("workflow_api_raw")