mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-17 08:47:49 +00:00
Add update all button to plugin list (#466)
This commit is contained in:
+23
-2
@@ -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`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user