diff options
| author | AAGaming <aa@mail.catvibers.me> | 2022-06-29 12:25:50 -0400 |
|---|---|---|
| committer | AAGaming <aa@mail.catvibers.me> | 2022-06-29 12:25:50 -0400 |
| commit | 3f2a2bbc040b41b517df1192f27697ed66037b5d (patch) | |
| tree | 17c75294c8d848d25f2634d1cfe3618f3b3956cc | |
| parent | 79e8af8be66a27835611dec062bf85cac7b09468 (diff) | |
| download | decky-loader-3f2a2bbc040b41b517df1192f27697ed66037b5d.tar.gz decky-loader-3f2a2bbc040b41b517df1192f27697ed66037b5d.zip | |
fix installing plugins
| -rw-r--r-- | backend/browser.py | 9 | ||||
| -rw-r--r-- | frontend/src/components/store/Store.tsx | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/backend/browser.py b/backend/browser.py index 1b802291..1e8c8d27 100644 --- a/backend/browser.py +++ b/backend/browser.py @@ -40,8 +40,7 @@ class PluginBrowser: Popen(["chmod", "-R", "555", self.plugin_path]) return True - async def _install(self, artifact, version, hash): - name = artifact.split("/")[-1] + async def _install(self, name, version, hash): rmtree(path.join(self.plugin_path, name), ignore_errors=True) self.log.info(f"Installing {artifact} (Version: {version})") async with ClientSession() as client: @@ -73,15 +72,15 @@ class PluginBrowser: async def install_plugin(self, request): data = await request.post() - get_event_loop().create_task(self.request_plugin_install(data["artifact"], data.get("version", "dev"), data.get("hash", False))) + get_event_loop().create_task(self.request_plugin_install(data.get("name", "No name"), data.get("version", "dev"), data.get("hash", False))) return web.Response(text="Requested plugin install") - async def request_plugin_install(self, artifact, version, hash): + async def request_plugin_install(self, name, version, hash): request_id = str(time()) self.install_requests[request_id] = PluginInstallContext(artifact, version, hash) tab = await get_tab("SP") await tab.open_websocket() - await tab.evaluate_js(f"DeckyPluginLoader.addPluginInstallPrompt('{artifact}', '{version}', '{request_id}', '{hash}')") + await tab.evaluate_js(f"DeckyPluginLoader.addPluginInstallPrompt('{name}', '{version}', '{request_id}', '{hash}')") async def confirm_plugin_install(self, request_id): request = self.install_requests.pop(request_id) diff --git a/frontend/src/components/store/Store.tsx b/frontend/src/components/store/Store.tsx index 4890cb9d..e317096f 100644 --- a/frontend/src/components/store/Store.tsx +++ b/frontend/src/components/store/Store.tsx @@ -19,6 +19,8 @@ export interface StorePlugin { export async function installFromURL(url: string) { const formData = new FormData(); + const splitURL = url.split('/'); + formData.append('name', splitURL[splitURL.length - 1].replace('.zip', '')); formData.append('artifact', url); await fetch('http://localhost:1337/browser/install_plugin', { method: 'POST', @@ -28,6 +30,7 @@ export async function installFromURL(url: string) { export async function requestPluginInstall(plugin: StorePlugin, selectedVer: StorePluginVersion) { const formData = new FormData(); + formData.append('name', plugin.name); formData.append('artifact', `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/${selectedVer.hash}.zip`); formData.append('version', selectedVer.name); formData.append('hash', selectedVer.hash); |
