diff options
| author | Jonas Dellinger <jonas@dellinger.dev> | 2023-05-29 18:29:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-29 09:29:36 -0700 |
| commit | 010feddf36646fb9695106bd64eab41e47e962fe (patch) | |
| tree | 4619a5c0fc1b2c9ca475ce644cce18464c77ca3e /frontend/src/store.tsx | |
| parent | 5114bb57112bf8bbad30768ffd26803d464b19a2 (diff) | |
| download | decky-loader-010feddf36646fb9695106bd64eab41e47e962fe.tar.gz decky-loader-010feddf36646fb9695106bd64eab41e47e962fe.zip | |
Add update all button to plugin list (#466)
Diffstat (limited to 'frontend/src/store.tsx')
| -rw-r--r-- | frontend/src/store.tsx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index 80485252..f0ad0c1b 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -23,6 +23,12 @@ export interface StorePlugin { image_url: string; } +export interface PluginInstallRequest { + plugin: string; + selectedVer: StorePluginVersion; + installType: InstallType; +} + // name: version export type PluginUpdateMapping = Map<string, StorePluginVersion>; @@ -74,8 +80,7 @@ export async function installFromURL(url: string) { } export async function requestPluginInstall(plugin: string, selectedVer: StorePluginVersion, installType: InstallType) { - const artifactUrl = - selectedVer.artifact ?? `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/${selectedVer.hash}.zip`; + const artifactUrl = selectedVer.artifact ?? pluginUrl(selectedVer.hash); await window.DeckyPluginLoader.callServerMethod('install_plugin', { name: plugin, artifact: artifactUrl, @@ -85,6 +90,18 @@ export async function requestPluginInstall(plugin: string, selectedVer: StorePlu }); } +export async function requestMultiplePluginInstalls(requests: PluginInstallRequest[]) { + await window.DeckyPluginLoader.callServerMethod('install_plugins', { + requests: requests.map(({ plugin, installType, selectedVer }) => ({ + name: plugin, + artifact: selectedVer.artifact ?? pluginUrl(selectedVer.hash), + version: selectedVer.name, + hash: selectedVer.hash, + install_type: installType, + })), + }); +} + export async function checkForUpdates(plugins: Plugin[]): Promise<PluginUpdateMapping> { const serverData = await getPluginList(); const updateMap = new Map<string, StorePluginVersion>(); @@ -96,3 +113,7 @@ export async function checkForUpdates(plugins: Plugin[]): Promise<PluginUpdateMa } return updateMap; } + +function pluginUrl(hash: string) { + return `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/${hash}.zip`; +} |
