diff options
| author | Marco Rodolfi <marco.rodolfi@tuta.io> | 2024-09-17 15:21:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-17 06:21:31 -0700 |
| commit | 2f90a4fcf7af67f7ed5c044982779579d1624f69 (patch) | |
| tree | 3a10b9a0a680472eb5f600cbab080ffca38b0a18 /frontend/src | |
| parent | 24fce1e093f311cb1d2bfb4e0dad0003af2d2348 (diff) | |
| download | decky-loader-2f90a4fcf7af67f7ed5c044982779579d1624f69.tar.gz decky-loader-2f90a4fcf7af67f7ed5c044982779579d1624f69.zip | |
Rebase semver parsing on main (#677)v3.0.1
Co-authored-by: Marco Rodolfi <marco.rodolfi.1992@gmail.com>
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/store.tsx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index 8ab8f50a..5391a15a 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -1,3 +1,5 @@ +import { compare } from 'compare-versions'; + import { InstallType, Plugin, installPlugin, installPlugins } from './plugin'; import { getSetting, setSetting } from './utils/settings'; @@ -137,7 +139,15 @@ export async function checkForPluginUpdates(plugins: Plugin[]): Promise<PluginUp const updateMap = new Map<string, StorePluginVersion>(); for (let plugin of plugins) { const remotePlugin = serverData?.find((x) => x.name == plugin.name); - if (remotePlugin && remotePlugin.versions?.length > 0 && plugin.version != remotePlugin?.versions?.[0]?.name) { + //FIXME: Ugly hack since plugin.version might be null during evaluation, + //so this will set the older version possible + const curVer = plugin.version ? plugin.version : '0.0'; + if ( + remotePlugin && + remotePlugin.versions?.length > 0 && + plugin.version != remotePlugin?.versions?.[0]?.name && + compare(remotePlugin?.versions?.[0]?.name, curVer, '>') + ) { updateMap.set(plugin.name, remotePlugin.versions[0]); } } |
