summaryrefslogtreecommitdiff
path: root/backend/main.py
diff options
context:
space:
mode:
authorbotato <63275405+botatooo@users.noreply.github.com>2022-08-27 00:01:23 -0400
committerGitHub <noreply@github.com>2022-08-26 21:01:23 -0700
commitb7d7ca04e12690b5e65259c8806e5e895cdc16aa (patch)
tree4cca1b72b69622e536dbb1ba13656d39a9420685 /backend/main.py
parentd4d1c2bbabfcec3c62767e614c9d67f516938af2 (diff)
downloaddecky-loader-b7d7ca04e12690b5e65259c8806e5e895cdc16aa.tar.gz
decky-loader-b7d7ca04e12690b5e65259c8806e5e895cdc16aa.zip
Refractor plugin backend (#111)v2.0.5-pre18
* refractor uninstall plugin backend * refractor plugin installation method * Change formatting in browser.py * Manually format main.py * Manually format utilities.py * remove inconsistency * remove unnecessary linebreaks * lol what * last minute pythoning * Fix async missing * lint * more refractor * await forgotten * fix: menu not disappearing after first click * lint * bug: fix double click on uninstall * depricate request installs * basic patch notes viewer, lazy-load settings and store, build frontend as esmodule, add lazy-loaded react-markdown, backend changes to accomodate ESModule frontend * refractor uninstall plugin backend * Change formatting in browser.py * Manually format main.py * Manually format utilities.py * remove unnecessary linebreaks * lol what * last minute pythoning * Fix async missing * rebase onto main * fix error, fix React crash if patch notes are opened before remote version info is loaded Co-authored-by: TrainDoctor <traindoctor@protonmail.com> Co-authored-by: AAGaming <aa@mail.catvibers.me>
Diffstat (limited to 'backend/main.py')
-rw-r--r--backend/main.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/backend/main.py b/backend/main.py
index dfbf1829..1f365fe5 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -36,10 +36,15 @@ CONFIG = {
"server_host": getenv("SERVER_HOST", "127.0.0.1"),
"server_port": int(getenv("SERVER_PORT", "1337")),
"live_reload": getenv("LIVE_RELOAD", "1") == "1",
- "log_level": {"CRITICAL": 50, "ERROR": 40, "WARNING":30, "INFO": 20, "DEBUG": 10}[getenv("LOG_LEVEL", "INFO")]
+ "log_level": {"CRITICAL": 50, "ERROR": 40, "WARNING": 30, "INFO": 20, "DEBUG": 10}[
+ getenv("LOG_LEVEL", "INFO")
+ ],
}
-basicConfig(level=CONFIG["log_level"], format="[%(module)s][%(levelname)s]: %(message)s")
+basicConfig(
+ level=CONFIG["log_level"],
+ format="[%(module)s][%(levelname)s]: %(message)s"
+)
logger = getLogger("Main")
@@ -55,11 +60,14 @@ class PluginManager:
self.web_app = Application()
self.web_app.middlewares.append(csrf_middleware)
self.cors = aiohttp_cors.setup(self.web_app, defaults={
- "https://steamloopback.host": aiohttp_cors.ResourceOptions(expose_headers="*",
- allow_headers="*", allow_credentials=True)
+ "https://steamloopback.host": aiohttp_cors.ResourceOptions(
+ expose_headers="*",
+ allow_headers="*",
+ allow_credentials=True
+ )
})
self.plugin_loader = Loader(self.web_app, CONFIG["plugin_path"], self.loop, CONFIG["live_reload"])
- self.plugin_browser = PluginBrowser(CONFIG["plugin_path"], self.web_app, self.plugin_loader.plugins)
+ self.plugin_browser = PluginBrowser(CONFIG["plugin_path"], self.plugin_loader.plugins)
self.settings = SettingsManager("loader", path.join(HOMEBREW_PATH, "settings"))
self.utilities = Utilities(self)
self.updater = Updater(self)
@@ -75,7 +83,7 @@ class PluginManager:
self.web_app.add_routes([get("/auth/token", self.get_auth_token)])
for route in list(self.web_app.router.routes()):
- self.cors.add(route)
+ self.cors.add(route)
self.web_app.add_routes([static("/static", path.join(path.dirname(__file__), 'static'))])
self.web_app.add_routes([static("/legacy", path.join(path.dirname(__file__), 'legacy'))])
@@ -99,7 +107,7 @@ class PluginManager:
async def load_plugins(self):
await self.wait_for_server()
self.plugin_loader.import_plugins()
- #await inject_to_tab("SP", "window.syncDeckyPlugins();")
+ # await inject_to_tab("SP", "window.syncDeckyPlugins();")
async def loader_reinjector(self):
await sleep(2)