diff --git a/custom_routes.py b/custom_routes.py
index 28f7888..70d19e0 100644
--- a/custom_routes.py
+++ b/custom_routes.py
@@ -2910,3 +2910,86 @@ async def auth_response_proxy(request):
return web.json_response(json_data, status=response.status)
except Exception as e:
return web.json_response({"error": str(e)}, status=500)
+
+
+@server.PromptServer.instance.routes.post("/comfyui-deploy/workflow")
+async def create_workflow_proxy(request):
+ data = await request.json()
+ name = data.get("name")
+ workflow_json = data.get("workflow_json")
+ workflow_api = data.get("workflow_api")
+ api_url = data.get("api_url", "https://api.comfydeploy.com")
+
+ auth_header = request.headers.get("Authorization")
+ if not auth_header:
+ return web.json_response(
+ {"error": "Authorization header is required"}, status=401
+ )
+
+ if not name or not workflow_json or not workflow_api:
+ return web.json_response(
+ {"error": "name, workflow_json, workflow_api are required"}, status=400
+ )
+
+ target_url = f"{api_url}/api/workflow"
+
+ request_body = {
+ "name": name,
+ "workflow_json": json.dumps(workflow_json),
+ "workflow_api": json.dumps(workflow_api),
+ }
+
+ try:
+ await ensure_client_session()
+ async with client_session.post(
+ target_url,
+ json=request_body,
+ headers={
+ "Content-Type": "application/json",
+ "Authorization": auth_header,
+ },
+ ) as response:
+ json_data = await response.json()
+ return web.json_response(json_data, status=response.status)
+ except Exception as e:
+ return web.json_response({"error": str(e)}, status=500)
+
+
+@server.PromptServer.instance.routes.post("/comfyui-deploy/workflow/version")
+async def create_workflow_version_proxy(request):
+ data = await request.json()
+ workflow_id = data.get("workflow_id")
+ workflow = data.get("workflow")
+ workflow_api = data.get("workflow_api")
+ comment = data.get("comment", "")
+ api_url = data.get("api_url", "https://api.comfydeploy.com")
+
+ auth_header = request.headers.get("Authorization")
+
+ if not auth_header:
+ return web.json_response(
+ {"error": "Authorization header is required"}, status=401
+ )
+
+ target_url = f"{api_url}/api/workflow/{workflow_id}/version"
+
+ request_body = {
+ "workflow": workflow,
+ "workflow_api": workflow_api,
+ "comment": comment,
+ }
+
+ try:
+ await ensure_client_session()
+ async with client_session.post(
+ target_url,
+ json=request_body,
+ headers={
+ "Content-Type": "application/json",
+ "Authorization": auth_header,
+ },
+ ) as response:
+ json_data = await response.json()
+ return web.json_response(json_data, status=response.status)
+ except Exception as e:
+ return web.json_response({"error": str(e)}, status=500)
diff --git a/web-plugin/index.js b/web-plugin/index.js
index c45c3b8..cb17bde 100644
--- a/web-plugin/index.js
+++ b/web-plugin/index.js
@@ -1112,9 +1112,9 @@ async function deployWorkflow() {
/** @type {LGraph} */
const graph = app.graph;
- let { endpoint, apiKey, displayName } = getData();
+ let { endpoint, apiKey, apiUrl, displayName } = getData();
- if (!endpoint || !apiKey || apiKey === "" || endpoint === "") {
+ if (!endpoint || !apiKey || apiKey === "" || endpoint === "" || !apiUrl) {
configDialog.show();
return;
}
@@ -1158,7 +1158,7 @@ async function deployWorkflow() {