mirror of
https://github.com/maubot/maubot
synced 2025-08-30 07:40:38 +00:00
Refactor management API impl
This commit is contained in:
parent
c7d16a5d46
commit
057ccc1914
5 changed files with 55 additions and 28 deletions
|
@ -21,7 +21,7 @@ import os.path
|
|||
from ...loader import PluginLoader, ZippedPluginLoader, MaubotZipImportError
|
||||
from .responses import (ErrPluginNotFound, ErrPluginInUse, plugin_import_error,
|
||||
plugin_reload_error, RespDeleted, RespOK, ErrUnsupportedPluginLoader)
|
||||
from . import routes, config
|
||||
from .base import routes, get_config
|
||||
|
||||
|
||||
def _plugin_to_dict(plugin: PluginLoader) -> dict:
|
||||
|
@ -74,7 +74,7 @@ async def reload_plugin(request: web.Request) -> web.Response:
|
|||
|
||||
|
||||
async def upload_new_plugin(content: bytes, pid: str, version: str) -> web.Response:
|
||||
path = os.path.join(config["plugin_directories.upload"], f"{pid}-v{version}.mbp")
|
||||
path = os.path.join(get_config()["plugin_directories.upload"], f"{pid}-v{version}.mbp")
|
||||
with open(path, "wb") as p:
|
||||
p.write(content)
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue