Skip to content

Commit

Permalink
Merge pull request #159 from wfjsw/debloat-init-1
Browse files Browse the repository at this point in the history
publish routes without having to replicate add_routes
  • Loading branch information
shadowcz007 authored Jan 28, 2024
2 parents 29e84e0 + 36db7e5 commit 31515b8
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ async def new_start(self, address, port, verbose=True, call_on_start=None):
PromptServer.start=new_start

# 创建路由表
routes = web.RouteTableDef()
routes = PromptServer.instance.routes

@routes.post('/mixlab')
async def mixlab_hander(request):
Expand Down Expand Up @@ -516,27 +516,6 @@ async def nodes_map_hander(request):

return web.json_response(result)

# 把插件自定义的路由添加到comfyui server里
def new_add_routes(self):
import nodes
try:
self.user_manager.add_routes(self.routes)
except:
print('pls update')

self.app.add_routes(routes)
self.app.add_routes(self.routes)
for name, dir in nodes.EXTENSION_WEB_DIRS.items():
self.app.add_routes([
web.static('/extensions/' + urllib.parse.quote(name), dir, follow_symlinks=True),
])
self.app.add_routes([
web.static('/', self.web_root, follow_symlinks=True),
])

PromptServer.add_routes=new_add_routes



# 扩展api接口
# from server import PromptServer
Expand Down

0 comments on commit 31515b8

Please sign in to comment.