summaryrefslogtreecommitdiff
path: root/frontend/src/store.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/store.tsx')
-rw-r--r--frontend/src/store.tsx25
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`;
+}