1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 23:14:49 +08:00

Added dynamic loading of extensions

This commit is contained in:
pythongosssss
2023-03-03 19:05:39 +00:00
parent c23af92baf
commit 592b377ac4
5 changed files with 34 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ import nodes
import execution
import uuid
import json
import glob
try:
import aiohttp
@@ -52,6 +53,11 @@ class PromptServer():
async def get_root(request):
return web.FileResponse(os.path.join(self.web_root, "index.html"))
@routes.get("/extensions")
async def get_extensions(request):
files = glob.glob(os.path.join(self.web_root, 'extensions/**/*.js'), recursive=True)
return web.json_response(list(map(lambda f: "/" + os.path.relpath(f, self.web_root).replace("\\", "/"), files)))
@routes.get("/view/{file}")
async def view_image(request):
if "file" in request.match_info: