diff options
| author | AAGaming <aa@bigdumb.gq> | 2022-06-01 17:50:10 -0400 |
|---|---|---|
| committer | AAGaming <aa@bigdumb.gq> | 2022-06-01 17:50:10 -0400 |
| commit | 86e23686aacccfe22a24e1d63c57f037b7ce2a4d (patch) | |
| tree | a7b899385d8d4523f966497778a31ddc14a270b2 /backend | |
| parent | bd1b2e82fdc6ff1725bab61593e1f54d0b975fe0 (diff) | |
| download | decky-loader-86e23686aacccfe22a24e1d63c57f037b7ce2a4d.tar.gz decky-loader-86e23686aacccfe22a24e1d63c57f037b7ce2a4d.zip | |
React Plugin install dialog (closes #75)
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/browser.py | 9 | ||||
| -rw-r--r-- | backend/utilities.py | 7 |
2 files changed, 11 insertions, 5 deletions
diff --git a/backend/browser.py b/backend/browser.py index 323fb9c3..a62e282a 100644 --- a/backend/browser.py +++ b/backend/browser.py @@ -80,10 +80,13 @@ class PluginBrowser: async def request_plugin_install(self, artifact, version, hash): request_id = str(time()) self.install_requests[request_id] = PluginInstallContext(artifact, version, hash) - tab = await get_tab("QuickAccess") + tab = await get_tab("SP") await tab.open_websocket() - await tab.evaluate_js(f"addPluginInstallPrompt('{artifact}', '{version}', '{request_id}')") + await tab.evaluate_js(f"DeckyPluginLoader.addPluginInstallPrompt('{artifact}', '{version}', '{request_id}')") async def confirm_plugin_install(self, request_id): request = self.install_requests.pop(request_id) - await self._install(request.gh_url, request.version, request.hash)
\ No newline at end of file + await self._install(request.gh_url, request.version, request.hash) + + def cancel_plugin_install(self, request_id): + self.install_requests.pop(request_id)
\ No newline at end of file diff --git a/backend/utilities.py b/backend/utilities.py index d69b9bfa..570ed568 100644 --- a/backend/utilities.py +++ b/backend/utilities.py @@ -12,6 +12,7 @@ class Utilities: self.util_methods = { "ping": self.ping, "http_request": self.http_request, + "cancel_plugin_install": self.cancel_plugin_install, "confirm_plugin_install": self.confirm_plugin_install, "execute_in_tab": self.execute_in_tab, "inject_css_into_tab": self.inject_css_into_tab, @@ -26,8 +27,7 @@ class Utilities: async def _handle_server_method_call(self, request): method_name = request.match_info["method_name"] try: - method_info = await request.json() - args = method_info["args"] + args = await request.json() except JSONDecodeError: args = {} res = {} @@ -43,6 +43,9 @@ class Utilities: 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 http_request(self, method="", url="", **kwargs): async with ClientSession() as web: async with web.request(method, url, **kwargs) as res: |
