shadowcz007 / comfyui-mixlab-nodes

Workflow-to-APP、ScreenShare&FloatingVideo、GPT & 3D、SpeechRecognition&TTS
https://mixlabnodes.com
MIT License
1.12k stars 67 forks source link

Web APP 无法Upload image #283

Open kryfo opened 1 month ago

kryfo commented 1 month ago

在127.0.0.0的情况下是可以正常在web APP 的input 中 upload image的 但是 在使用了 --listen 启动comfyui后 就无法在web APP 的input 中 upload image了 , 请问是什么原因导致的呢? 有解决方案吗?

shadowcz007 commented 1 month ago

试试使用本机ip替换127.0.0.0

cd0304 commented 1 month ago

127.0.0.1是可以的,但这样没法公网,我发现之前的版本是可以,但后来更新后开始不行,定位了一下,发现有很多地方的使用被浏览器限制了,比如crypto 在网卡ip下不能使用,需要做兼容,修改如下:

async function calculateImageHash(blob) { const buffer = await blob.arrayBuffer(); let hashBuffer = null; if (window.crypto && window.crypto.subtle) { // 使用 crypto.subtle hashBuffer = await crypto.subtle.digest('SHA-256', buffer); } else { // 使用备选方案 console.error('crypto.subtle is not supported in this environment.'); // 示例:使用 crypto-js 库作为备选方案 try { const CryptoJS = require("crypto-js"); hashBuffer = CryptoJS.SHA256(buffer); console.log("SHA-256 hash:", hash.toString()); } catch (error) { console.error("Failed to use alternative library:", error); } } const hashArray = Array.from(new Uint8Array(hashBuffer)); const hashHex = hashArray.map(byte => byte.toString(16).padStart(2, '0')).join(''); return hashHex; }

cd0304 commented 1 month ago

但这个只是解决了图片上传问题,在网卡ip下,递交执行也是无法执行命令,还是安全限制的原因,需要彻底排查一下

yzjleo commented 1 day ago

试一下https访问