Use less freezing way of adding plugin subapps
This commit is contained in:
parent
e582cadb42
commit
a4cfb97b67
1 changed files with 3 additions and 1 deletions
|
@ -18,6 +18,7 @@ import logging
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
from aiohttp.web_urldispatcher import PrefixedSubAppResource
|
||||||
from aiohttp.abc import AbstractAccessLogger
|
from aiohttp.abc import AbstractAccessLogger
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
|
@ -57,7 +58,8 @@ class MaubotServer:
|
||||||
return self.subapps[instance_id], url
|
return self.subapps[instance_id], url
|
||||||
except KeyError:
|
except KeyError:
|
||||||
app = web.Application(loop=self.loop)
|
app = web.Application(loop=self.loop)
|
||||||
self.app.add_subapp(subpath, app)
|
resource = PrefixedSubAppResource(subpath, app)
|
||||||
|
self.app.router.register_resource(resource)
|
||||||
self.subapps[instance_id] = app
|
self.subapps[instance_id] = app
|
||||||
return app, url
|
return app, url
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue