From 47e9708a209c9f48159880b90a710ea26ec09a29 Mon Sep 17 00:00:00 2001 From: marios8543 Date: Wed, 18 Oct 2023 17:21:57 +0300 Subject: [PATCH] fix static/lang file fetch and method call --- backend/src/loader.py | 7 +++---- backend/src/plugin/method_call_request.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/backend/src/loader.py b/backend/src/loader.py index 49f80c64c..162cf4986 100644 --- a/backend/src/loader.py +++ b/backend/src/loader.py @@ -102,13 +102,12 @@ async def enable_reload_wait(self): self.watcher.disabled = False async def handle_frontend_assets(self, request: web.Request): - file = path.join(path.dirname(__file__), "..", "static", request.match_info["path"]) - + file = Path(__file__).parents[1].joinpath("static").joinpath(request.match_info["path"]) return web.FileResponse(file, headers={"Cache-Control": "no-cache"}) async def handle_frontend_locales(self, request: web.Request): req_lang = request.match_info["path"] - file = path.join(path.dirname(__file__), "..", "locales", req_lang) + file = Path(__file__).parents[1].joinpath("locales").joinpath(req_lang) if exists(file): return web.FileResponse(file, headers={"Cache-Control": "no-cache", "Content-Type": "application/json"}) else: @@ -143,7 +142,7 @@ def import_plugin(self, file: str, plugin_directory: str, refresh: bool | None = self.plugins.pop(plugin.name, None) if plugin.passive: self.logger.info(f"Plugin {plugin.name} is passive") - self.plugins[plugin.name] = plugin + self.plugins[plugin.name] = plugin.start() self.logger.info(f"Loaded {plugin.name}") if not batch: self.loop.create_task(self.dispatch_plugin(plugin.name, plugin.version)) diff --git a/backend/src/plugin/method_call_request.py b/backend/src/plugin/method_call_request.py index 8d93a6cc4..cebe34f81 100644 --- a/backend/src/plugin/method_call_request.py +++ b/backend/src/plugin/method_call_request.py @@ -26,4 +26,4 @@ async def wait_for_result(self): await self.event.wait() if not self.response.success: raise Exception(self.response.result) - return self.response \ No newline at end of file + return self.response.result \ No newline at end of file