-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path__init__.py
39 lines (30 loc) · 1.1 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
from aiohttp import web
from server import PromptServer # type: ignore pylint: disable=import-error
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class Constants:
@property
def BASE_DIR(self):
return BASE_DIR
constants = Constants()
from .nodes.pinterest_image import PinterestImageNode
NODE_CLASS_MAPPINGS = {
"PinterestImageNode": PinterestImageNode
}
NODE_DISPLAY_NAME_MAPPINGS = {
"PinterestImageNode": "Pinterest Image"
}
WEB_DIRECTORY = "./web/comfyui"
COMMON_DIRECTORY = "./web/common"
# Add routes for serving the common directory
# might be useful later on
def add_routes():
@PromptServer.instance.routes.get("/extensions/ComfyUI_Dados_Nodes/common/{path:.*}")
async def serve_common_file(request):
path = request.match_info['path']
file_path = os.path.join(BASE_DIR, COMMON_DIRECTORY, path)
if os.path.exists(file_path) and os.path.isfile(file_path):
return web.FileResponse(file_path)
return web.Response(status=404)
add_routes()
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]