mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-12 11:46:37 +08:00
Create internal route table.
This commit is contained in:
parent
3e52e0364c
commit
d73dd32be1
1
routes/__init__.py
Normal file
1
routes/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from routes.internal.internal_routes import InternalRoutes
|
||||
5
routes/internal/README.md
Normal file
5
routes/internal/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# ComfyUI Internal Routes
|
||||
|
||||
All routes under the `/internal` path are designated for **internal use by ComfyUI only**. These routes are considered part of the internal API are not intended for use by external applications.
|
||||
|
||||
The internal routes may change at any time without notice.
|
||||
18
routes/internal/internal_routes.py
Normal file
18
routes/internal/internal_routes.py
Normal file
@ -0,0 +1,18 @@
|
||||
from aiohttp import web
|
||||
|
||||
class InternalRoutes:
|
||||
def __init__(self):
|
||||
self.routes = web.RouteTableDef()
|
||||
self._app = None
|
||||
|
||||
def setup_routes(self):
|
||||
@self.routes.get('/files/')
|
||||
async def internal_test(request):
|
||||
return web.json_response({"message": "Internal route is working"})
|
||||
|
||||
def get_app(self):
|
||||
if self._app is None:
|
||||
self._app = web.Application()
|
||||
self.setup_routes()
|
||||
self._app.add_routes(self.routes)
|
||||
return self._app
|
||||
@ -29,6 +29,8 @@ from app.frontend_management import FrontendManager
|
||||
from app.user_manager import UserManager
|
||||
from model_filemanager import download_model, DownloadModelStatus
|
||||
from typing import Optional
|
||||
from routes import InternalRoutes
|
||||
|
||||
|
||||
class BinaryEventTypes:
|
||||
PREVIEW_IMAGE = 1
|
||||
@ -72,6 +74,7 @@ class PromptServer():
|
||||
mimetypes.types_map['.js'] = 'application/javascript; charset=utf-8'
|
||||
|
||||
self.user_manager = UserManager()
|
||||
self.internal_routes = InternalRoutes()
|
||||
self.supports = ["custom_nodes_from_web"]
|
||||
self.prompt_queue = None
|
||||
self.loop = loop
|
||||
@ -593,6 +596,7 @@ class PromptServer():
|
||||
|
||||
def add_routes(self):
|
||||
self.user_manager.add_routes(self.routes)
|
||||
self.app.add_subapp('/internal', self.internal_routes.get_app())
|
||||
|
||||
# Prefix every route with /api for easier matching for delegation.
|
||||
# This is very useful for frontend dev server, which need to forward
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user