diff options
| author | botato <63275405+botatooo@users.noreply.github.com> | 2022-08-27 00:01:23 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-26 21:01:23 -0700 |
| commit | b7d7ca04e12690b5e65259c8806e5e895cdc16aa (patch) | |
| tree | 4cca1b72b69622e536dbb1ba13656d39a9420685 /backend/utilities.py | |
| parent | d4d1c2bbabfcec3c62767e614c9d67f516938af2 (diff) | |
| download | decky-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/utilities.py')
| -rw-r--r-- | backend/utilities.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/backend/utilities.py b/backend/utilities.py index e06e770d..b3431cb6 100644 --- a/backend/utilities.py +++ b/backend/utilities.py @@ -7,14 +7,17 @@ from injector import inject_to_tab import helpers import subprocess + class Utilities: def __init__(self, context) -> None: self.context = context self.util_methods = { "ping": self.ping, "http_request": self.http_request, + "install_plugin": self.install_plugin, "cancel_plugin_install": self.cancel_plugin_install, "confirm_plugin_install": self.confirm_plugin_install, + "uninstall_plugin": self.uninstall_plugin, "execute_in_tab": self.execute_in_tab, "inject_css_into_tab": self.inject_css_into_tab, "remove_css_from_tab": self.remove_css_from_tab, @@ -45,12 +48,23 @@ class Utilities: res["success"] = False return web.json_response(res) + async def install_plugin(self, artifact="", name="No name", version="dev", hash=False): + return await self.context.plugin_browser.request_plugin_install( + artifact=artifact, + name=name, + version=version, + hash=hash + ) + async def confirm_plugin_install(self, request_id): return await self.context.plugin_browser.confirm_plugin_install(request_id) def cancel_plugin_install(self, request_id): return self.context.plugin_browser.cancel_plugin_install(request_id) + async def uninstall_plugin(self, name): + return await self.context.plugin_browser.uninstall_plugin(name) + async def http_request(self, method="", url="", **kwargs): async with ClientSession() as web: async with web.request(method, url, ssl=helpers.get_ssl_context(), **kwargs) as res: @@ -74,12 +88,12 @@ class Utilities: return { "success": True, - "result" : result["result"]["result"].get("value") + "result": result["result"]["result"].get("value") } except Exception as e: return { - "success": False, - "result": e + "success": False, + "result": e } async def inject_css_into_tab(self, tab, style): @@ -104,7 +118,7 @@ class Utilities: return { "success": True, - "result" : css_id + "result": css_id } except Exception as e: return { |
