Update preview nodes

- Support custom background color in preview node
- Fix Preview node does not update automatically with same mesh name
- Add system config file that allow custom clients IP address
This commit is contained in:
MrForExample
2024-03-10 20:25:05 +01:00
parent f442e095f9
commit b4e136aa55
14 changed files with 195 additions and 45 deletions
+11 -4
View File
@@ -1,11 +1,11 @@
import server
import folder_paths as comfy_paths
import os
import time
import subprocess
from ..shared_utils.common_utils import cstr
ROOT_PATH = os.path.join(comfy_paths.get_folder_paths("custom_nodes")[0], "ComfyUI-3D-Pack")
web = server.web
SUPPORTED_VIEW_EXTENSIONS = (
@@ -19,11 +19,18 @@ SUPPORTED_VIEW_EXTENSIONS = (
'.splat'
)
web_conf = None
def set_web_conf(new_web_conf):
global web_conf
web_conf = new_web_conf
@server.PromptServer.instance.routes.get("/extensions/ComfyUI-3D-Pack/html/viewfile")
async def view_file(request):
query = request.rel_url.query
# Security check to see if query client is local
if request.remote == "127.0.0.1" and "filepath" in query:
if request.remote in web_conf['clients_ip'] and "filepath" in query:
filepath = query["filepath"]
cstr(f"[Server Query view_file] Get file {filepath}").msg.print()
@@ -31,4 +38,4 @@ async def view_file(request):
if filepath.lower().endswith(SUPPORTED_VIEW_EXTENSIONS) and os.path.exists(filepath):
return web.FileResponse(filepath)
return web.Response(status=404)
return web.Response(status=404)