From 010feddf36646fb9695106bd64eab41e47e962fe Mon Sep 17 00:00:00 2001 From: Jonas Dellinger Date: Mon, 29 May 2023 18:29:36 +0200 Subject: Add update all button to plugin list (#466) --- frontend/src/store.tsx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'frontend/src/store.tsx') 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; @@ -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 { const serverData = await getPluginList(); const updateMap = new Map(); @@ -96,3 +113,7 @@ export async function checkForUpdates(plugins: Plugin[]): Promise