Working backend, automatically swtich languages with steam and language fixes.

This commit is contained in:
Marco Rodolfi
2023-02-01 18:46:09 +01:00
parent 4732509728
commit b895f2c308
6 changed files with 47 additions and 41 deletions
+7
View File
@@ -1,5 +1,6 @@
from asyncio import Queue, sleep
from json.decoder import JSONDecodeError
from json import loads
from logging import getLogger
from os import listdir, path
from pathlib import Path
@@ -83,6 +84,7 @@ class Loader:
server_instance.add_routes([
web.get("/frontend/{path:.*}", self.handle_frontend_assets),
web.get("/locales/{path:.*}", self.handle_frontend_locales),
web.get("/plugins", self.get_plugins),
web.get("/plugins/{plugin_name}/frontend_bundle", self.handle_frontend_bundle),
web.post("/plugins/{plugin_name}/methods/{method_name}", self.handle_plugin_method_call),
@@ -105,6 +107,11 @@ class Loader:
return web.FileResponse(file, headers={"Cache-Control": "no-cache"})
async def handle_frontend_locales(self, request):
file = path.join(path.dirname(__file__), "locales", request.match_info["path"])
return web.FileResponse(file, headers={"Cache-Control": "no-cache"})
async def get_plugins(self, request):
plugins = list(self.plugins.values())
return web.json_response([{"name": str(i) if not i.legacy else "$LEGACY_"+str(i), "version": i.version} for i in plugins])