From 8ae7f40e16888d163c480491c1f3247f0979f844 Mon Sep 17 00:00:00 2001 From: huyunan Date: Tue, 26 Mar 2024 03:06:15 +0000 Subject: [PATCH] remove chiness --- __init__.py | 5 +---- js/comfyui-share-common.js | 6 ------ 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/__init__.py b/__init__.py index e8980ca6..929bd834 100644 --- a/__init__.py +++ b/__init__.py @@ -2126,12 +2126,9 @@ async def api_get_comfyworkflows_auth(request): return web.Response(status=404) return web.json_response({"comfyworkflows_sharekey" : comfyworkflows_auth}) -# 跨域获得本地数据 -args.enable_cors_header = "*" # 或者可以是 '*' +args.enable_cors_header = "*" if hasattr(server.PromptServer.instance, "app"): - # 获取应用实例 app = server.PromptServer.instance.app - # 创建并添加 CORS 中间件 cors_middleware = server.create_cors_middleware(args.enable_cors_header) app.middlewares.append(cors_middleware) diff --git a/js/comfyui-share-common.js b/js/comfyui-share-common.js index 6c0c3abf..647b607c 100644 --- a/js/comfyui-share-common.js +++ b/js/comfyui-share-common.js @@ -165,13 +165,11 @@ export function parseURLPath(urlPath) { export const shareToEsheep= () => { - // 1、获得workflow和图片信息 app.graphToPrompt() .then(prompt => { const nodes = app.graph._nodes const { potential_outputs, potential_output_nodes } = getPotentialOutputsAndOutputNodes(nodes); const workflow = prompt['workflow'] - // 2、把workflow和图片保存到本地 api.fetchApi(`/manager/set_esheep_workflow_and_images`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -180,14 +178,10 @@ export const shareToEsheep= () => { images: potential_outputs }) }).then(response => { - // 获取域名(不包含子域) var domain = window.location.hostname; - // 获取端口号 var port = window.location.port; - // 如果端口为空字符串,则可能是使用了标准端口(80 for http and 443 for https) port = port || (window.location.protocol === 'http:' ? '80' : window.location.protocol === 'https:' ? '443' : ''); var full_domin = domain + ':' + port - // 打开新tab window.open('https://www.esheep.com/app/workflow_upload?from_local='+ full_domin, '_blank'); }); })